Hi
You can do this like that
it only accepts letters and numbers
regards
jQuery(document).ready( function () {
jQuery("#username").on("input", function(){
var regexp = /[^a-zA-Z0-9]/g;
if($(this).val().match(regexp)){
$(this).val( $(this).val().replace(regexp,'') );
}
});
} );