making trim toggleable in javascript