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...
};