Restrict typing after maxlength?!


Is there html code to restrict typing after maxlength is reached in input? If yes please put me a sample :wink:
And how do I set the minimum length?

Thank you

Hi there kasperkyd,

does this help…

<input type="text" maxlength="10">


1 Like

Hi coothead, nice seeing you again :blush:

Oh yessssssssssss that works
how do I set minimum?

Hi there kasperkyd,

test this…

<form action="#">
 <input type="text" minlength="5" maxlength="10" name="test" required>
 <input type="submit">

Note that IE11 does not support " minlength". :eek:



Noted about IE11

Thank you very much that works flawlessly :+1:


        No problem, you’re very welcome. :winky:

Out of main subject, do you know if is possible to control the order of the TAB button in forms? Let’s say I have 2 columns 4 rows, when I press the TAB key the cursor jumps from left to right, I want it to go vertically! Any idea :innocent:

You can use the tabindex attribute with a positive sequence of numbers to create the order you require. However most resources advise not to do this but instead rely on a a logical progression of the dom.

This is achievable with flexbox or grid these days and you can have columns as required so that the natural tab order is down one column and the next. Usually you should think about the logical structure of your html first and then style it to fit your design afterwards. Sometimes it’s not always possible to have the html structure you need if you have some awkward design patterns but you should really think about the html structure first.


Awesomeeeeeee Thank you very much :+1:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.