Link disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Link

Description

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

This property is currently only used with style sheet links.

Set the disabled property with the following Values

Value Description
true|false Sets whether the linked document is disabled
  • true - The linked document is disabled
  • false - The linked document is not disabled

Return Value

A Boolean, returns true if the linked document is disabled, otherwise it returns false

The following code shows how to disable the linked document:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<link id="myLink" rel="stylesheet" type="text/css" href="http://java2s.com/style/bootstrap.min.css">
</head>/*from ww w.  j  a v a  2 s.co m*/
<body>

<h1>I am formatted with a linked style sheet</h1>


<button onclick="myFunction()">Test</button>

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

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

</body>
</html>

Related Tutorials