<input type="text" name="user" maxlength="10">
I have some code:
$("#user").keyup(function(e){
if($("#user").val().length < 4) {$("#spanUser").html("Too Short !");} //works
How can I write:
if($("#user").val().length > 0 < 4)... // between 1 and 4
if($("#user").val().length == 10) {play a beep sound;}
Firstly, you should use the
keypressevent, as your current code allows someone to hold down the key and get multiple characters.