Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function alphanumeric(evt) {
- var theEvent = evt || window.event;
- var key = theEvent.keyCode || theEvent.which;
- key = String.fromCharCode( key );
- var regex = /[^a-zA-Z0-9]/;
- if( regex.test(key) ) {
- theEvent.returnValue = false;
- if(theEvent.preventDefault) theEvent.preventDefault();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement