Live Demo: http://jsfiddle.net/thisizmonster/DveuB/
How can I change this so that the input only allows the characters A-Z, a-z, 0-9 while typing, without using a re
I'm using this function.
By modifying RegExp you can get rid of any characters you don't like personally.
$(function(){
$("#user").bind('keypress',function(e){
var regex = new RegExp("^[a-zA-Z0-9 ]+$");
var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
if (regex.test(str)) return true;
e.preventDefault();
return false;
});
});