1 2 3 4 5 6 |
var string = "+hello this is text"; string = string.replace(' ','');//no spaces string = string.replace('+',''); //no + sign alert(string); |
Replace whitespace (alternative if above does not work) This works for integers unlike above.
1 2 3 |
label = label.replace(/\s/g, ""); |