maxlength has been deprecated for type="number". Instead of that you can use max and size attribute for type="number". size holds the length of the field and max holds the possible maximum value for that field. If you want to restrict the length while entering the value you can disable it by jquery or javascript. Let's see the following example:
MaxLength.html:
------------------------------------------------
<html>
<head><title>Maxlength for type="number"</title></head>
<body>
Employee Name: <input type="text" name="name" maxlength="15"/>
Employee ID: <input type="number" name="id" id="emp" size="10" max="9999999999"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$('#emp').bind('keypress', function(){
if($(this).val().length>=$(this).attr('size')){
return false;
}
});
</script>
</body>
</html> Output: ----------------------- Employee Name:
Employee ID:
5