Input URL placeholder attribute

Definition and Usage

placeholder Sets or returns the value of the placeholder attribute of the URL field.

The HTML placeholder attribute specifies a short hint that describes the expected value of the URL field (for example, a sample value or a brief description of the expected format).

A short hint is displayed in the text field before the user enters a value.

This attribute reflects the HTML placeholder attribute.

See also:

HTML Reference Manual:HTML <input> placeholder Attribute

Example

Example 1

Change the placeholder text of the URL field:

document.getElementById("myURL").placeholder = "Please enter the URL here...";

Try it yourself

Example 2

Get the placeholder text of the URL field:

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

Try it yourself

Syntax

Return placeholder attribute:

urlObject.placeholder

Set placeholder attribute:

urlObject.placeholder = text

Attribute Value

Value Description
text Specifies a brief hint (word or phrase) for the expected value of the URL field.

Technical Details

Return Value: A string value indicating a brief hint for the expected value of the URL field.

Browser Support

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