Thursday 29 December 2011

HTML5 Input Type - Number

 The input element number that should contain a numeric value  for input fields .

Syntax:
Points: <input type="number" name="points" min="1" max="15" />

Example:

 <!DOCTYPE html>
<html>
<body>

<form action="demo_form.asp" method="get">
Points: <input type="number" name="points" min="1" max="15" />
<input type="submit" />
</form>

</body>
</html>


The following attributes  specify  for the number type:
Attribute Value Description
max number Specifies the maximum value allowed
min number Specifies the minimum value allowed
step number Specifies legal number intervals (if step="3", legal numbers could be -3,0,3,6, etc)
value number Specifies the default value

No comments:

Post a Comment