Changed native trim()-method to jQuery $.trim() since the native version isn't supported in IE < 9.