Consider the following markup:
<div id="0">
<h1 id="1">
<span id="2"><span id="3">lorem ipsum</span></span>
</h1>
</div>
How can I find the first parent of span#3 that is of block level (i.e. has display: block
) using jQuery? In this case that would be h1#1
.
$("#3").parents().filter(function() {
return $(this).css("display") === "block";
}).first()
http://jsfiddle.net/DFURw/
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