With form submitting, users will enter information such as first name, last name, age, etc... here is the code to grab that information
var fn = $("#first_name").val();
I want to make sure whatever is stored in fn doesn't contain any spaces, such that if a user enters a first name followed by a space, or presses the space by and then types their first name, it needs to be removed. I have tried .trim()
and strg.replace(/\s+/g, ' ');
but these do not work.
I do not know or code in javascript/jquery so I don't know much about it, I just know I need to fix it. Thanks for anyone who can provide some help!