Javascript DOM HTML Input Week type Property get

Introduction

Return which type of form element the week field is:

var x = document.getElementById("myWeek").type;

Click the button to return which type of form element the week field is.

input elements with type="week" are not supported in Internet Explorer or Firefox.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="week" id="myWeek">
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {//  www.ja  va2 s  .  co m
  var x = document.getElementById("myWeek").type;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The type property returns which type of form element the week field is.

The <input type="week"> element is not supported in Firefox.




PreviousNext

Related