Input URL disabledProperty

Input URL 对象参考手册Input URL Object

Examples

Disable the URL field:

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

Output:


Try it Yourself »

Definition and Usage

The disabled property is used to set or return whether the URL field is disabled.

Elements that use the disabled property are unavailable and unclickable. Disabled elements are usually displayed in gray in browsers.

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property

Note:Internet Explorer or Safari browsers do not support HTML <input> elements using the type="url" attribute.


Syntax

Return the disabled property:

urlObject.disabled

Set the disabled property:

urlObject.disabled=true|false

Property Values

Value Description
true|false Describes whether the URL field is available.
  • true - The URL field is unavailable
  • false - Default. The URL field is available

Technical Details

Return Value: A Boolean value, returns true if the URL field is unavailable, otherwise returns false


More Examples

Example

Check whether the URL field is available:

var x = document.getElementById("myURL").disabled;
xThe output result is:
true

Try it Yourself »

Example

Disable or enable the URL field:

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

Try it Yourself »


Related Pages

HTML Reference:HTML <input> disabled Attribute


Input URL 对象参考手册Input URL Object Other Extensions