Replaced JavaScript trim() which is not supported on IE8 with JQuery $.trim()