Latest web development tutorials

HTML DOM Input Number placeholder attribute

Input Number Object Reference Input Number Object

Examples

Modify the message text number field:

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

try it"

Definition and Usage

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

placeholder attribute provides a description of the input fields can be expected message.

The prompt is displayed in the input field empty, and disappears when the field gets the focus.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the placeholder attribute.

Note: Internet Explorer 9 and earlier versions of IE do not support the use of type = "number" <input> element attributes.


grammar

Back placeholder attributes:

numberObject .placeholder

Setting placeholder properties:

numberObject .placeholder= text

Property Value

描述
text 描述了number字段预期值提示信息 (一个单词或一个短语)

technical details

return value: String that represents the expected value of the number field message


More examples

Examples

Display message number field:

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

try it"


Related Pages

Reference the HTML: the HTML <the INPUT> placeholder attribute


Input Number Object Reference Input Number Object