Javascript DOM HTML Input Search disabled Property get

Introduction

Find out if a search field is disabled or not:

var x = document.getElementById("mySearch").disabled;

Click the button to find out if the search field is disabled.

View in separate window

<!DOCTYPE html>
<html>
<body>

Search: <input type="search" id="mySearch" disabled>
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*  w  ww  .jav  a2 s  .c  o m*/
  var x = document.getElementById("mySearch").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related