HTML DOM Input Number Object | HTML Number Input Tutorial

HTML DOM Input Number Object


<form name="myForm" action="https://www.PuStudy.Com/resources/html-forms-action.html">
	
<input type="number" name="myField" value="12345678">

<button>Submit</button>
</form>

 

The above example demonstrates usage of the <input> element with the type attribute set to number (i.e. type="number").

The number value represents a control for setting the element's value to a string representing a number. This is a numerical value. If a value is specified, it must be a valid floating-point number.

Specifying a min and/or max Number

The min and max attributes can be used with the number field to specify a minimum and maximum number. If specified, they must have a value that is a valid floating-point number.

The following example specifies a min value of 100 and a max value of 200. Therefore the user can only select a number that falls within that range.