Input Time name Property - Change the name of a time field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Time

Description

Input Time name Property - Change the name of a time field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Time: <input type="time" id="myTime" name="usr_time">

<button onclick="display()">Display name</button>
<button onclick="change()">Change name</button>

<script>
function display() {
    var x = document.getElementById("myTime").name;
    console.log("The name of the time field is: " + x);
}

function change() {//from w  w  w  . j a v a  2s  . co  m
    var x = document.getElementById("myTime").name = "newTimeName";
    console.log("The name was changed to: " + x);
}
</script>

</body>
</html>

Related Tutorials