Fix IE8 compatability by replacing native trim() call with jquery equivalent