Use jQuery.trim

jQuery has it's own `trim` function, so cut some code an use it instead of the local one.