Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery select all br with display:none;

Tags:

jquery

How do I select an element based on its css?

I need to select a br with inline style display:none. This is not the same thing as br:hidden, because that selects elements that are hidden in other ways, and I don't want that.

Thanks.

like image 520
Jourkey Avatar asked Oct 23 '09 21:10

Jourkey


4 Answers

You could try:

$("br").filter(function() { return $(this).css("display") == "none" })
like image 52
Tim Banks Avatar answered Nov 20 '22 15:11

Tim Banks


Another way to do this would be to use jQuery's attribute selector:

$("br[style$='display: none;']")
like image 22
jesal Avatar answered Nov 20 '22 14:11

jesal


Using filter.

$("br").filter(function () {
    return $(this).css("display") == "none";
});
like image 24
chelmertz Avatar answered Nov 20 '22 14:11

chelmertz


How about something like this:

$(document).ready(function() {
  $("div:hidden").each(function() {
    if ($(this).css("display") == "none") {
        // do something
    }
  });
});
like image 41
spig Avatar answered Nov 20 '22 15:11

spig