jquery - how to set parent attribute?
问题 I'm trying to write an if statement where if one of the elements has it's display set to "none", I want the parent element to also display "none"... This is the code I'm trying, which doesn't work... /* tried this first */ if($('#prevx a').attr('display') == 'none') { $(this).parent().attr('display','none'); } /* and then this */ if($('#prevxa > a').attr('display') == 'none') { $('#prevxa').attr('display','none'); } The markup looks like this: <ul> <li class="navnext" id="nextxa"> <a id=