<div id="c1" class="features" style="height:100px;width:100px;"></div>
<div id="c2" class="features" style="height:120px;width:100px;"></div>
<div id="c3" class="features" style="height:90px;width:100px;"></div>
<div...>
How do I use JQuery to find the shortest div
?
For example, the above would result in div id="c3" because its height is 90px.
var shortest = [].reduce.call($(".features"), function(sml, cur) {
return $(sml).height() < $(cur).height() ? sml : cur;
});
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