HTMLSelectElement.disabled - Web APIs | MDN
Có thể bạn quan tâm
- Skip to main content
- Skip to search
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
- Learn more
- See full compatibility
- Report feedback
The HTMLSelectElement.disabled property is a boolean value that reflects the disabled HTML attribute, which indicates whether the control is disabled. If it is disabled, it does not accept clicks. A disabled element is unusable and un-clickable.
In this article
- Value
- Examples
- Specifications
- Browser compatibility
Value
A boolean value.
Examples
HTML
html<label> Allow drinks? <input id="allow-drinks" type="checkbox" /> </label> <label for="drink-select">Drink selection:</label> <select id="drink-select" disabled> <option value="1">Water</option> <option value="2">Beer</option> <option value="3">Pepsi</option> <option value="4">Whisky</option> </select>JavaScript
jsconst allowDrinksCheckbox = document.getElementById("allow-drinks"); const drinkSelect = document.getElementById("drink-select"); allowDrinksCheckbox.addEventListener("change", (event) => { drinkSelect.disabled = !event.target.checked; });Result
Specifications
| Specification |
|---|
| HTML# dom-fe-disabled |
Browser compatibility
Help improve MDN
Was this page helpful to you? Yes No Learn how to contributeThis page was last modified on Sep 18, 2025 by MDN contributors.
View this page on GitHub • Report a problem with this content Filter sidebar- The HTML DOM API
- HTMLSelectElement
- Instance properties
- autocomplete
- disabled
- form
- labels
- length
- multiple
- name
- options
- required
- selectedIndex
- selectedOptions
- size
- type
- validationMessage
- validity
- value
- willValidate
- Instance methods
- add()
- checkValidity()
- item()
- namedItem()
- remove()
- reportValidity()
- setCustomValidity()
- showPicker()
- Inheritance
- HTMLElement
- Element
- Node
- EventTarget
- Related pages for HTML DOM
- BeforeUnloadEvent
- DOMStringMap
- ErrorEvent
- HTMLAnchorElement
- HTMLAreaElement
- HTMLAudioElement
- HTMLBRElement
- HTMLBaseElement
- HTMLBodyElement
- HTMLButtonElement
- HTMLCanvasElement
- HTMLDListElement
- HTMLDataElement
- HTMLDataListElement
- HTMLDialogElement
- HTMLDivElement
- HTMLDocument
- HTMLElement
- HTMLEmbedElement
- HTMLFieldSetElement
- HTMLFormControlsCollection
- HTMLFormElement
- HTMLFrameSetElement Deprecated
- HTMLHRElement
- HTMLHeadElement
- HTMLHeadingElement
- HTMLHtmlElement
- HTMLIFrameElement
- HTMLImageElement
- HTMLInputElement
- HTMLLIElement
- HTMLLabelElement
- HTMLLegendElement
- HTMLLinkElement
- HTMLMapElement
- HTMLMediaElement
- HTMLMenuElement
- HTMLMetaElement
- HTMLMeterElement
- HTMLModElement
- HTMLOListElement
- HTMLObjectElement
- HTMLOptGroupElement
- HTMLOptionElement
- HTMLOptionsCollection
- HTMLOutputElement
- HTMLParagraphElement
- HTMLPictureElement
- HTMLPreElement
- HTMLProgressElement
- HTMLQuoteElement
- HTMLScriptElement
- HTMLSourceElement
- HTMLSpanElement
- HTMLStyleElement
- HTMLTableCaptionElement
- HTMLTableCellElement
- HTMLTableColElement
- HTMLTableElement
- HTMLTableRowElement
- HTMLTableSectionElement
- HTMLTemplateElement
- HTMLTextAreaElement
- HTMLTimeElement
- HTMLTitleElement
- HTMLTrackElement
- HTMLUListElement
- HTMLUnknownElement
- HTMLVideoElement
- HashChangeEvent
- History
- ImageData
- Location
- MessageChannel
- MessageEvent
- MessagePort
- Navigator
- PageRevealEvent
- PageSwapEvent
- PageTransitionEvent
- Plugin Deprecated
- PluginArray Deprecated
- PromiseRejectionEvent
- RadioNodeList
- TimeRanges
- UserActivation
- ValidityState
- Window
- WorkletGlobalScope
- Guides
- Using microtasks in JavaScript with queueMicrotask()
- In depth: Microtasks and the JavaScript runtime environment
Từ khóa » Html A Tag Disabled
-
Disabled Href Tag - Javascript - Stack Overflow
-
Disable A HTML Link/anchor Tag - Code With Hugo
-
HTML Input Disabled Attribute - W3Schools
-
HTML Disabled Attribute - W3Schools
-
How To Disable Links | CSS-Tricks
-
Disable HTML Elements - Orange Digital Accessibility Guidelines
-
How To Disable A HTML Anchor Tag
-
How To Disable A Anchor Tag In HTML? - NiceSnippets
-
HTML Attribute: Disabled - HTML: HyperText Markup Language | MDN
-
HTML Disabled Attribute - GeeksforGeeks
-
HTML | Disabled Attribute - GeeksforGeeks
-
How To Disable A Tag Code Example
-
Disabling A Link
-
HTML Button Disabled Attribute - Dofactory