jquery replace space with empty string code example
Example 1: js replace space with underscore
var string = "my name";
string = string.replace(/ /g,"_"); //returns my_name
Example 2: js remove spaces
str = str.trim();
var string = "my name";
string = string.replace(/ /g,"_"); //returns my_name
str = str.trim();