changed .trim() to $.trim()