HTMLLinkElement: disabled property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

The disabled property of the HTMLLinkElement interface is a boolean value that represents whether the link is disabled. It only has an effect with style sheet links (rel property set to stylesheet).

If disabled attribute is specified in the HTML when it is loaded, the stylesheet will not be loaded during page load. Instead, the stylesheet will be loaded only when the disabled property is set to false or removed. Setting the disabled property using JavaScript causes the stylesheet to be removed from the document's Document.styleSheets list.

It reflects the disabled attribute of the <link> element.

Value

A boolean.

Examples

html
<link
  id="el"
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
  rel="stylesheet"
  disabled
  crossorigin="anonymous" />
js
const el = document.getElementById("el");
console.log(el.disabled); // Output: true

// Set the disabled property to false to enable the stylesheet
el.disabled = false;
console.log(el.disabled); // Output: false

Specifications

Specification
HTML
# dom-link-disabled

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
disabled
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote
footnote In Chrome and other Blink-based browsers, adding the disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets.
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote
footnote Since Edge 79, adding the disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets.
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote Full support
Opera – Full support
Opera 12.1 (Release date: 2012-11-20)
footnote
footnote In Chrome and other Blink-based browsers, adding the disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets.
Safari – Full support
Safari 1 (Release date: 2003-06-23)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote
footnote In Chrome Android and other Blink-based browsers, adding the disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets.
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 12.1 (Release date: 2012-10-09)
footnote
footnote In Chrome and other Blink-based browsers, adding the disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets.
Safari on iOS – Full support
Safari on iOS 1 (Release date: 2007-06-29)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote
footnote In Chrome and other Blink-based browsers, adding the disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets.
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote
footnote In WebView Android and other Blink-based browsers, adding the disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets.
WebView on iOS – Full support
WebView on iOS 1 (Release date: 2007-06-29)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.

See also