Use jQuery to match variable text?
- by VUELA
Hello! I have a sidebar navigation that lists blog entry titles down the side of the page. I am trying to write some jquery that will check the text in the title of the current full blog entry page and match it with the corresponding title in the sidebar navigation so that I can apply a class to style for an active state link ... but I'm not quite getting it! Here is the link to an example page: http://ncw-commercial.com/property-listings/eastpoint-plaza-lot.html, and below is my current code. I have also tried using :contains but could not figure out how to get that to work with a variable rather than direct text.
$('.single-journal-entry-wrapper .journal-entry .title').each(function(){
var activeTitle = $(this).text();
$(".feedburnerFeedBlock .headline a").filter(function(index) {
return $(this).text() == "activeTitle";
}).parent().addClass("activeTitle");
});