This is the html content from which I want to select all elements inside report having display block using jQuery
$("#report:visible")
does not work for me.
<div id="report">
<div id="p1" style="display: block;">
<input id="pname1" type="checkbox" name="report1">
<input id="pname2" type="checkbox" name="report2">
</div>
<div id="p2" style="display: none;">
<input id="pname1" type="checkbox" name="report1">
<input id="pname2" type="checkbox" name="report2">
</div>
<div id="p3" style="display: none;">
<input id="pname1" type="checkbox" name="report1">
<input id="pname2" type="checkbox" name="report2">
</div>
<div id="p4" style="display: block;">
<input id="pname3" type="checkbox" name="report1">
<input id="pname4" type="checkbox" name="report2">
</div>
</div>
Maybe you can use this piece of jQuery :
$("#report div:visible").each(function() {
console.log($(this).attr('id'));
});
Or this one :) ?
$("#report div:visible");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With