15
rated 0 times
[
20]
[
5]
/ answers: 1 / hits: 107225
/ 14 Years ago, sat, june 5, 2010, 12:00:00
I want to make a text box allow only letters (a-z) using jQuery.
Any examples?
More From » jquery
I want to make a text box allow only letters (a-z) using jQuery.
Any examples?
<input name=lorem onkeyup=this.value=this.value.replace(/[^a-z]/g,'');>
And can be the same to onblur
for evil user who like to paste instead of typing ;)
[+] Pretty jQuery code:
<input name=lorem class=alphaonly>
<script type=text/javascript>
$('.alphaonly').bind('keyup blur',function(){
var node = $(this);
node.val(node.val().replace(/[^a-z]/g,'') ); }
);
</script>