Trim to remove white space

Viewed 218819

jQuery trim not working. I wrote the following command to remove white space. Whats wrong in it?

var str = $('input').val();

str = jquery.trim(str);
console.log(str);

Fiddle example.

5 Answers

Try this

  $('input').val($('input').val().trim());
Related