Javascript DOM HTML Input URL disabled Property get

Introduction

Find out if a URL field is disabled or not:

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

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

elements with type="url" are not supported in Safari.

View in separate window

<!DOCTYPE html>
<html>
<body>

Homepage: <input type="url" id="myURL" disabled>
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {/*from w w  w .  j a va  2  s  . co  m*/
  var x = document.getElementById("myURL").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related