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 elem
Using filter.
$("br").filter(function () {
return $(this).css("display") == "none";
});
Another way to do this would be to use jQuery's attribute selector:
$("br[style$='display: none;']")
You could try:
$("br").filter(function() { return $(this).css("display") == "none" })
How about something like this:
$(document).ready(function() {
$("div:hidden").each(function() {
if ($(this).css("display") == "none") {
// do something
}
});
});
Use jQuery.map:
var brs = $('br');
jQuery.map(brs, function(elem, i){
if(elem.css('display') == 'none')
return elem;
return null;
});
$("br").filter(function() {
return $(this).css("display") == "none";
})
Works like a charm.