转自:http://stackoverflow.com/questions/6982692/html5-input-type-date-default-value-to-today Date.prototype.toDateInputValue = (function() { var local = new Date(this); local.setMinutes(this.getMinutes() - this.getTimezoneOffset()); return local.toJSON().slice(0,10); });
$(document).ready( function() { $('#datePicker').val(new Date().toDateInputValue()); });
document.getElementById('datePicker').value = new Date().toDateInputValue();
html5 input type date default value
最新推荐文章于 2023-11-22 19:10:19 发布