Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLInputElement
  4. disabled

HTMLInputElement: 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⁩.

TheHTMLInputElement.disabled property is a boolean value that reflects thedisabled 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.

Value

A boolean value.

Examples

HTML

html
<p>  <label>    <input name="b" value="1" type="checkbox" disabled /> Check    this box!  </label></p><p>  <label>    <input name="b" value="2" type="checkbox" /> Enable the    other checkbox.  </label></p>

JavaScript

js
const checkBox = document.getElementById("check-box");const toggleBox = document.getElementById("toggle-box");toggleBox.addEventListener("change", (event) => {  checkBox.disabled = !event.target.checked;});

Result

Specifications

Specification
HTML
# dom-fe-disabled

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp