简体   繁体   中英

HTML5 <input type=date> change using javascript

I have <input type=date id=something>

I want change the data using 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.

Because the date format has to be in ISO 8601 format you might have to edit what you are passing as the value

eg:

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

works but

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

doesn't

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.

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