I have the following jQuery shell which works:
$('.jq_noSpaces').on('change', function(){
alert('you changed the value in the box');
});
My form attributes are id="username" name="username"
How do I use the following jQuery replace function to automatically change remove the spaces from the input field?
str.replace(/\s+/g, '');
Thanks
You can use the syntax:
$(this).val($(this).val().replace(/\s+/g, ''));
Inside the event handler.