mercredi 23 mars 2016

multiple condition using range in if statement

$('#name').keypress(function(e) {
    if(e.which < 97 || e.which > 122){
        e.preventDefault();
    }
});

Above code allow only alphabets only but in the same time it also disallow space to work. I know the code for space is 32, but how should I add that this scenario?

Aucun commentaire:

Enregistrer un commentaire