📜  设置输入日期以选择初始日期 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:13.282000             🧑  作者: Mango

代码示例1
Like any HTML input field, the browser will leave the date element empty unless a default value is specified within the value attribute. Unfortunately, HTML5 doesn't provide a way of specifying 'today' in the HTMLInputElement.prototype.value.

One must instead explicitly provide a RFC3339 formatted date (YYYY-MM-DD). For example:

element.value = "2011-09-29"