I had the same problem.
In this case, you should change the maximum length to 10 so that it does not give out the maximum length and does not set the maximum length that you want for your text field using javascript, as shown below.
function setMaxLength(obj, len) { return (obj.value.length < len); }
and call this function as follows
<input type="text" id="txtAge" name="txtAge" class="text" placeholder="Age (optional)" maxlength="10" onkeypress="return setMaxLength(this,2);">
This will solve your problem.
Ankitkumar bhatt
source share