Javascript DOM HTML Link disabled Property get

Introduction

Find out if the linked document is disabled or not:

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

Click the button to find out if the linked document is disabled or not.

View in separate window

<!DOCTYPE html>
<html>
<head>
<link id="myLink" rel="stylesheet" type="text/css" href="style.css">
</head>/*from   w  w w. ja  v  a2 s.  c o  m*/
<body>
<h1>I am formatted with a linked style sheet</h1>
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
  var x = document.getElementById("myLink").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related