I have a UL list inside that UL list is a handful of LI's that 开发者_开发问答all have "rel" attributes as identifying tokens as the ID/Class tags have been used for other reasons. Anyway this is what I am attempting currently
if($('#column1').find('li:[rel='+theElements[i]+']').css({'opacity':0})){hideit = true;}else{hideit = false;}
Which finds the right column, but then turns around and hides the whole column. I definately feel as though I am approaching this the wrong way. I tried .is(':visible') but I don't think that worked properly for me. Anyone have an Idea?
What I am doing based on the "hideit =" part is building a JSON string to control the layout and save things for a later date for my users.
You are setting the opacity instead of reading it. Do this:
if($('#column1').find('li:[rel='+theElements[i]+']').css('opacity') == 0) {
hideit = true;
} else {
hideit = false;
}
Sounds like you're looking for something like:
$(theElements).each(function()
{
var elem = $('#column1').find('li:[rel=' + this + ']');
if(elem.css('opacity') === 0)
elem.hide();
});
精彩评论