Input Number placeholder property

HTML DOM Input Number placeholder property Input Number object

To modify the prompt text for the number field:

document.getElementById("myNumber").placeholder = "Amount";

Try it out . . .

Definitions and usages

The placeholder property is used to set or return the placeholder property value of the number field.

The placeholder property provides a hint that describes the expected value of the input field.

The prompt appears when the input field is empty and disappears when the field gets focus.


Browser support

HTML DOM Input Number placeholder property HTML DOM Input Number placeholder property HTML DOM Input Number placeholder property HTML DOM Input Number placeholder property HTML DOM Input Number placeholder property

All major browsers support the placeholder property.

Note: Internet Explorer 9 and earlier versions of IE do not support the use of the type-"number" property for the element of the .lt;input>


Grammar

Return to the placeholder property:

numberObject .placeholder

Set the placeholder property:

numberObject .placeholder= text

The property value

value describe
text Describe the expected value prompt information of the Number field (a word or a phrase)

Technical details

Return value: String, which indicates the expected value of the number field


More instances

Show tips for the number field:

var x = document.getElementById("myNumber").placeholder;
x The output is:
Quantity

Try it out . . .


Related pages

HTML reference: HTML slt;input> placeholder property


HTML DOM Input Number placeholder property Input Number object