Hi,
I am able to iterate over a list and add a class to each Item using:
$('ul li').each(function(index){
Code: Select all
$(this)
.addClass('selected-list'); });
But what I want to do is selectively add the class when a value in a hidden label in the list matches a given criteria. Something like the poor example below. Can I do this?
$('ul li').each(function(index){
if(my label).text = my criteria) {
$(this)
.addClass('selected-list');
}
});
Regards,
Joe