Input URL placeholder Property
Example
Change the placeholder text of a URL field:
document.getElementById("myURL").placeholder = "Type URL
here..";
Try it yourself »
Definition and Usage
The placeholder property sets or returns the value of the placeholder attribute of a URL field.
The placeholder attribute specifies a short hint that describes the expected value of an URL field (e.g. a sample value or a short description of the expected format).
The short hint is displayed in the text field before the user enters a value.
This property reflects the HTML placeholder attribute.
Browser Support
The placeholder property is supported in all major browsers.
Note: The placeholder property is not supported in Internet Explorer 9 and earlier versions.
Syntax
Return the placeholder property:
urlObject.placeholder
Set the placeholder property:
urlObject.placeholder=text
Property Values
Value | Description |
---|---|
text | Specifies a short hint (one word or a short phrase) that describes the expected value of the URL field |
Technical Details
Return Value: | A String, representing a short hint that describes the expected value of the URL field |
---|
More Examples
Example
Get the placeholder text of a URL field:
var x = document.getElementById("myURL").placeholder;
The result of x will be:
Address of web site
Try it yourself »
Related Pages
HTML reference: HTML <input> placeholder Attribute
Input URL Object