So I’m trying to trim any spaces BEFORE and AFTER the text input value…
Any ideas? Driving me nuts. I tried reading up on $.trim(). But can’t get it to work properly.
Code:
var campaign_values = {
name : $.trim($('.nameField').val().toLowerCase().replace(/\s/g, "_")),
// other variables...
};
Not sure what problem you were having with trim, but you should be able to use it like this:
Though in this case, I think it is clearer to use javascript
trim()