JQuery get height of each previous element
- by Jk_
I'm trying to find a good solution to get the height of all the element above my target.
So loop the prev() function ! Any ideas on how I could deal with that ?
<div>
<div style="height:50px;width:100%"></div>
<div style="height:12px;width:100%"></div>
<div style="height:23px;width:100%"></div>
<div style="height:56px;width:100%"></div>
<div id="#mytarget"><p>HERE</p></div>
</div>
$('#mytarget').prev().each(function() {
alert($(this).outerHeight());
});
and it will fires ["56","23","12","50"].