Allow only numbers using JavaScript for textboxes -


this question has answer here:

i new javascript. have created form submits details database. have different textboxes, need accept only letters , allow numbers.

i got code while doing research, code tells me of invalid pattern. can me code allows only letters. tried modify code takes letters failed.

function f_check_lett(form){    //only letters , numbers allowed        var text = form.bucketname.value;     alert(text);      var filter = /^[a-za-z0-9]+$/;     if (filter.test(text)) {         form.submit();      } else {         form.bucketname.select();         alert("only allow letters , numbers!");     } }   

use filter

var filter = /^[a-za-z]+$/; 

in filter [a-za-z0-9] accept character of: 'a' 'z', 'a' 'z', '0' '9'

since need letters, remove 0-9 filter.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -