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\'
If you only wanna put numbers, try this! :D
$("#id").keyUp(function(){ if(isNaN($(this).val())) { $(this).val(0); } $(this).val($(this).val().replace(/ +?/g, '')); })