简体   繁体   English

HTML5 <input type=date> 使用javascript更改

[英]HTML5 <input type=date> change using javascript

I have <input type=date id=something> 我有<input type=date id=something>

I want change the data using javascript. 我想使用JavaScript更改数据。

I am sending the query in mysql and I request for the date, so I need to put that date there I tried document.getElementById.('something').value=$new and it didn't work. 我在mysql中发送查询,并要求输入日期,因此我需要将该日期放在尝试使用document.getElementById.('something').value=$new ,该日期不起作用。

Because the date format has to be in ISO 8601 format you might have to edit what you are passing as the value 由于日期格式必须为ISO 8601格式,因此您可能需要编辑要传递的值

eg: 例如:

<input type="date" name="dt" value="1999-07-16">

works but 工作,但

<input type="date" name="dt" value="1999-7-16">

doesn't

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM