// This doesn't work $(this).find('li a').eq(2).text().replace('foo','bar'); // This works var $thirdLink = $(this).find('li a').eq(2); var linkText = $thirdLink.text().replace('foo','bar'); $thirdLink.text(linkText);
// This doesn't work $(this).find('li a').eq(2).text().replace('foo','bar'); // This works var $thirdLink = $(this).find('li a').eq(2); var linkText = $thirdLink.text().replace('foo','bar'); $thirdLink.text(linkText);