HTML DOM Input URL readOnly property
Examples
URL field is set to read-only:
document.getElementById("myURL").readOnly = true;
Output:
try it"
Definition and Usage
readOnly property sets or returns the URL field is read-only.
Read-only fields can not be modified. But you can copy the contents of the field.
This property reflects the HTML readonly attribute.
Tip: To ensure the accuracy of the form data, you can use the disabled property instead.
Browser Support
All major browsers support readOnly property.
Note: Internet Explorer or Safari browser does not support the use of type = "url" attribute of the HTML <input> elements.
grammar
Back readOnly attributes:
urlObject .readOnly
Set readOnly properties:
urlObject .readOnly=true|false
Property Value
value | description |
---|---|
true | false | Describes the URL field is read-only
|
technical details
return value: | Boolean value that, if the URL field is read-only returns true, otherwise returns false. |
---|
More examples
Examples
See if the URL field is read-only:
var x = document.getElementById("myURL").readOnly;
x The output is: true
try it"
Related Pages
HTML Reference Manual: HTML <the INPUT> Readonly property
Input URL objects