Javascript DOM HTML Input Range type Property get

Introduction

Return which type of form element the slider control is:

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

Click the button to display which type of form element the slider control is.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="range" id="myRange">

<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {//  w  ww .  ja  v  a 2  s  . co m
  var x = document.getElementById("myRange").type;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The type property returns which type of form element the slider control is.




PreviousNext

Related