"If the value of the type attribute is text, email, search, password, tel, or
url, this attribute specifies the maximum number of characters (in Unicode
code points) that the user can enter; for other control types, it is ignored.
It can exceed the value of the size attribute. "
It looks like Firefox and IE supports MaxLength despite the spec.
You can use the min and max values to limit it for example, max="9999". They
can enter more digits, but the control will register as having an invalid
value. Check it out here: look at the
first Number input with the placeholder text: "Enter a Number"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The "MaxLength" function not working.
<asp:TextBox id="txtEntidad" runat="server" Width="35px" MaxLength="4" pattern="*"/>
What I do?
Albert
Not working in mobile device (iPhone, Android)
What can I do?
Albert
This is actually from the HTML5
spec.
"If the value of the type attribute is text, email, search, password, tel, or
url, this attribute specifies the maximum number of characters (in Unicode
code points) that the user can enter; for other control types, it is ignored.
It can exceed the value of the size attribute. "
It looks like Firefox and IE supports MaxLength despite the spec.
You can use the min and max values to limit it for example, max="9999". They
can enter more digits, but the control will register as having an invalid
value. Check it out here: look at the
first Number input with the placeholder text: "Enter a Number"