I have a field that does not need any white spaces. I need to remove any as they are entered. Here\'s what I\'m trying... no luck so far
$(\'#noSpacesField\'
$('#noSpacesField').keyup(function() { $(this).val($(this).val().replace(/ +?/g, '')); });
This will remove spaces as you type, and will also remove the tab char.