Javascript DOM HTML Link disabled Property set

Introduction

Disable the linked document:

document.getElementById("myLink").disabled = true;

Click the button to disable the linked document.

View in separate window

<!DOCTYPE html>
<html>
<head>
<link id="myLink" rel="stylesheet" type="text/css" href="style.css">
</head>/*w w  w .  jav a 2 s  .c om*/
<body>
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
  document.getElementById("myLink").disabled = true;
}
</script>

</body>
</html>

The disabled property sets or gets whether the linked document is disabled, or not.

This property is currently only used with style sheet links.

When set to true, the linked style sheet will not have any effect.

The disabled property accepts and returns a boolean type value.

Value Description
true The linked document is disabled
false The linked document is not disabled

The disabled property returns true if the linked document is disabled, otherwise it returns false.




PreviousNext

Related