Input Number placeholder Property
Example
Modify the placeholder hint text of the number field:
document.getElementById("myNumber").placeholder = "Amount";
Try it »
Definition and Usage
The placeholder property sets or returns the value of the placeholder attribute of the number field.
The placeholder property provides hint text that describes the expected value of the input field.
This hint is displayed when the input field is empty and disappears when the field gains focus.
Browser support





All major browsers support the placeholder property.
Note: Internet Explorer 9 and earlier versions do not support the HTML using the type="number" attribute .
Syntax
Return the placeholder property:
numberObject
.placeholder
Set the placeholder property:
numberObject
.placeholder=
text
Attribute values
| Value | Description |
|---|---|
| text | Describes the hint information for the expected value of the number field (a word or a phrase) |
Technical Details
| Return Value: | A string representing the hint information for the expected value of the number field |
|---|
More examples
Example
Display the placeholder hint of the number field:
var x = document.getElementById("myNumber").placeholder;
x
The output is:
Quantity
Try it »
Related pages
HTML reference: HTML placeholder property
Input Number Object