如何使用以下代码在html 5表单中将当前日期指示为占位符。
Date: <input type="date" placeholder="mm/dd/yyyy" name="date" />
To set the date inputs value to the current date, you can do something like this:
var d = new Date(),
s = d.getFullYear() + '-' + (d.getMonth()+1) + '-' + d.getDate()
document.getElementsByName('date')[0].value = s;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.