Jquery trim() function instead of javascript equivalent as it's not supported by IE8.