【发布时间】:2016-12-01 05:03:14
【问题描述】:
<div class="input-field col s4" style="max-height: 58px;">
<input id="email" name="email" type="email" maxlength="30" class="validate" required length='30' disabled="true">
<label for="email" data-error="Invalid Email ID">Email ID</label>
</div>
<div class="input-field col s4" style="max-height: 58px;">
<input id="dob" name="dob" type="date" class="datepicker" required>
<label for="dob" data-error="Invalid Date of Birth">Date of Birth</label>
</div>
我尝试在文本字段中设置值
$('#email').attr('value', result.result.Email);
$('#email').next().addClass('active');
我将如何设置日期?
我试过了
$('#dob').attr('value', result.result.DoB);
$('#dob').next().addClass('active');
它没有工作。然后我尝试了这个
$('#dob').val(result.result.DoB);
$('#dob').next().addClass('active');
它正在设置日期,但它的标签重叠。
以及如何将其设置为不同的格式,例如 1995 年 6 月 17 日
【问题讨论】:
标签: javascript jquery date materialize