I\'m trying to remove blank spaces from the begining and ending of inputs in general without adding a class or id or event
I tried this live demo but is using
Try this:
function trim(el) {
var trimmedValue = el.val().trim();
el.val(trimmedValue);
}
Your syntax for .trim() is wrong. To trim a input's value you don't need any regex, just try to change this:
$(.input).text().trim();
to this:
$('input').val().trim();
input is not a class, so you don't have to put the dot before it. Then you have to include it inside ' '. The value of an input is given by val() method, not text().
This will only trim the input's value, you have to use this inside a function in order to make it works properly, as in the example above.