Input Week name Property - Change the name of a week field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Week

Description

Input Week name Property - Change the name of a week field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Year and Week: <input type="week" id="myWeek" name="year_week">

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

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

function change() {/*  w w w. j  a v  a 2 s . c  o m*/
    var x = document.getElementById("myWeek").name = "newWeekName";
    console.log("The name was changed to: " + x);
}
</script>

</body>
</html>

Related Tutorials