Need to use jQuery.find to find element with specific style

前端 未结 7 1397
天命终不由人
天命终不由人 2021-01-01 10:28

Right... I need to find all < ul style=\"display: block;\"> elements, so that I can set it do display:none.

I think I\'m on the right path here... but not quite t

7条回答
  •  情书的邮戳
    2021-01-01 10:55

    Don't know how to do it in one line, but here's how you can do it in a couple more:

    jQuery('#adminMenu li').find("ul").each(function (){
      if($(this).css("display") == "block"){
        // do something
      }
    });
    

    If what you want is to handle all visible elements (instead of only the display: block ones), you could try the :visible selector instead.

提交回复
热议问题