Input URL disabled attribute

Definition and Usage

disabled Attribute to set or return whether the URL field 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 Attribute

Example

Example 1

Disable the URL field:

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

Try it yourself

Example 2

Check if the URL field is disabled:

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

Try it yourself

Example 3

Disable and enable the URL field:

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

Try it yourself

Syntax

Return the disabled attribute:

urlObject.disabled

Set the disabled attribute:

urlObject.disabled = true|false

Attribute value

Value Description
true|false

Specifies whether the URL field should be disabled.

  • true - The URL field is disabled
  • false - Default. The URL field is not disabled

Technical Details

Return value: Boolean value, if the URL field is disabled, it returns true; otherwise return false.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported 10.0 Supported Not Supported Supported