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 属性
Example
Example 1
Change the placeholder text of the URL field:
document.getElementById("myURL").placeholder = "Please enter the URL here...";
Example 2
Get the placeholder text of the URL field:
var x = document.getElementById("myURL").placeholder;
Syntax
Return placeholder attribute:
urlObject.placeholder
Set placeholder attribute:
urlObject.placeholder = text
属性值
值 | 描述 |
---|---|
text | 规定描述对 URL 字段预期值的简短提示(词或短语)。 |
技术细节
返回值: | 字符串值,表示描述对 URL 字段预期值的简短提示。 |
---|
浏览器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 10.0 | 支持 | 不支持 | 支持 |