How can I display value of input type=“datetime-lo

2019-08-30 06:16发布

问题:

My code like this :

<div id="output">test</div>
<div><input type=date value="2018-02-27"><button>Get</button></div>
<div><input type=time value="21:10"><button>Get</button></div>
<div><input type=datetime-local value="2018-02-27 21:10"><button>Get</button></div>

Demo like this :

http://jsfiddle.net/BP5kC/42/

Input type date and input type time success display the value. But input type datetime-local not success display the value

I use latest chrome browser (Version 64.0.3282.186 (Official Build) (64-bit)) to try it

How can I solve the error?

回答1:

The format should be 2018-02-27T21:10. You forgot to write T.

<input type=datetime-local value="2018-02-27T21:10">