SO Answer: javascript regex to disallow all special characters
See: http://stackoverflow.com/questions/15243387/javascript-regex-to-disallow-all-special-characters
HTML
<input type="text" id="value" />
JavaScript
$('#value').bind('keypress', function(e) {
if($('#value').val().length == 0){
if (e.which == 32){//space bar
e.preventDefault();
}
var valid = (e.which >= 48 && e.which <= 57) || (e.which >= 65 && e.which <= 90) || (e.which >= 97 && e.which <= 122);
if (!valid) {
e.preventDefault();
}
}
});