Input Button disabled Attribute

Definition and Usage

disabled Attribute to set or return whether the input button should be disabled.

Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.

This property reflects the HTML disabled attribute.

See also:

HTML Reference Manual:HTML <input> disabled Atributo

Example

Example 1

Disable button:

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

Try it yourself

Example 2

Check if the button is disabled:

var x = document.getElementById("myBtn").disabled;

Try it yourself

Example 3

Enable and disable button:

function disableBtn() {
    document.getElementById("myBtn").disabled = true;
}
function undisableBtn() {
    document.getElementById("myBtn").disabled = false;
}

Try it yourself

Syntax

Return disabled attribute:

buttonObject.disabled

Set disabled attribute:

buttonObject.disabled = true|false

Halaga ng Atributo

Halaga Paglalarawan
tama|maliit

Tinutukoy kung kailangan ipagbawal ang buton na ipinapasok

  • tama - Ang buton na ipinapasok ay pinagbawal
  • maliit - Default. Ang buton na ipinapasok ay hindi pinagbawal

Detalye ng Teknolohiya

Bilang Halimbawa: Boolean Value, kung ang buton na ipinapasok ay pinagbawal, ibabalik tama, kung hindi ibabalik maliit.

Suporta ng Browser

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporta Suporta Suporta Suporta Suporta