Input Number placeholder Attribute
Definition and Usage
placeholder
Sets or returns the value of the placeholder attribute of the numeric field.
The HTML placeholder attribute specifies a brief prompt that describes the expected value of a numeric field (for example, a sample value or a brief description of the expected format).
A brief prompt will be displayed in the numeric field before the user enters a value.
See also:
HTML Reference Manual:HTML <input> placeholder Attribute
Example
Example 1
Change the placeholder text for the numeric field:
document.getElementById("myNumber").placeholder = "Total";
Example 2
Display the placeholder text for the numeric field:
var x = document.getElementById("myNumber").placeholder;
Syntax
Return the placeholder attribute:
numberObject.placeholder
Set placeholder attribute:
numberObject.placeholder = text
Attribute Value
Value | Description |
---|---|
text | Specifies a brief hint (word or phrase) for the expected value of a numeric field. |
Technical Details
Return Value: | A string value that represents a brief hint for the expected value of a numeric field. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |