Articles → HTML 5 → Number Input Element In Html5
Number Input Element In Html5
Purpose
Syntax
Example
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form>
<input type="number">
<input type="submit" value="Click Me" />
</form>
</body>
</html>
Try It
Output
Click to Enlarge
Setting Up The Min And Max Value
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form>
<input type="number" min="2" max="11">
<input type="submit" value="Click Me" />
</form>
</body>
</html>
Output
Click to Enlarge
Browser Support
Internet Explorer | Firefox | Chrome | Safari | Opera | Edge |
---|
Yes | Yes | Yes | Yes | Yes | Yes |