HTMLinput标签Date默认值修改为当前时间
HTMLinput标签Date默认值修改为当前时间有个input输入框,type = “date”,默认显示当前日期:<label class="col-sm-2 col-sm-offset-1 control-label">时间</label><div class="col-sm-3"><input id="currentDate" type="date
·
HTMLinput标签Date默认值修改为当前时间
有个input输入框,type = “date”,默认显示当前日期:
<label class="col-sm-2 col-sm-offset-1 control-label">时间</label>
<div class="col-sm-3">
<input id="currentDate" type="date" name="start" id="start" class="laydate-icon form-control layer-date">
</div>
<script>
$(document).ready(function() {
// 显示默认日期
var time = new Date();
var day = ("0" + time.getDate()).slice(-2);
var month = ("0" + (time.getMonth() + 1)).slice(-2);
var today = time.getFullYear() + "-" + (month) + "-" + (day);
$('#currentDate').val(today);
}
</script>
更多推荐
已为社区贡献8条内容
所有评论(0)