Change the name of a time field:
document.getElementById("myTime").name = "newTimeName";
Click the buttons to display or change the value of the name attribute of the time field.
<!DOCTYPE html> <html> <body> Time: <input type="time" id="myTime" name="usr_time"> <p id="demo"></p> <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myTime").name; document.getElementById("demo").innerHTML ="The name of the time field is: " + x; } function change() {/*w w w. jav a 2 s . c o m*/ var x = document.getElementById("myTime").name = "newTimeName"; document.getElementById("demo").innerHTML = "The name was changed to: " + x; } </script> </body> </html>