THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Input Number placeholder Property

Input Number Object Reference Input Number Object

Example

Change the placeholder text of a number field:

document.getElementById("myNumber").placeholder = "Amount";
Try it Yourself »

Definition and Usage

The placeholder property sets or returns the value of the placeholder attribute of a number field.

The placeholder attribute specifies a short hint that describes the expected value of a number field (e.g. a sample value or a short description of the expected format).

The short hint is displayed in the number field before the user enters a value.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The placeholder property is supported in all major browsers.

Note: The placeholder property is not supported in Internet Explorer 9 and earlier versions.


Syntax

Return the placeholder property:

numberObject.placeholder

Set the placeholder property:

numberObject.placeholder=text

Property Values

Value Description
text Specifies a short hint (one word or a short phrase) that describes the expected value of the number field

Technical Details

Return Value: A String, representing a short hint that describes the expected value of the number field

More Examples

Example

Display the placeholder text of a number field:

var x = document.getElementById("myNumber").placeholder;

The result of x will be:

Quantity
Try it Yourself »

Related Pages

HTML reference: HTML <input> placeholder attribute


Input Number Object Reference Input Number Object