简体   繁体   中英

how to change the html input type time field to only accept like this -( 00:01:25 )

i wanted to input time duration in hh:mm:ss format (example - 01:23:45) in html, pls suggest me the best method. Thanks in advance

How is it possible in html? is there any direct input type available for that? Please help !!

You can use the default time tag in the html as below

 <time>10:00</time>

or if you want to input time using input tag and setting type to time

<input type="time" name="time" />

Here you go check below code

 <:DOCTYPE html> <html> <body> Time: <input type="time" id="Time" value="01:23.45"> <button onclick="myFunction()">Click to see the selected time</button> <p id="SeeTime"></p> <script> function myFunction() { var x = document.getElementById("Time");value. document.getElementById("SeeTime");innerHTML = x; } </script> </body> </html>

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