What is the proper mark-up in jQuery (or JavaScript) to get the style attribute "position" for an element in the DOM?
Example:
<div id="Parent">
Parent Element
<ul class="child">
<li>
<p>inner child elements</p>
</li>
</ul>
</div>
#Parent {
position: relative;
}
.child {
position: absolute;
}
$(function() {
// What to type here to get "style attribute position" of say #Parent?
})
$('#someElementID').css('position');
http://api.jquery.com/css/
Use this, in jQuery:
$(element).css("position");
And more:
$(element).offset();
$(element).offset().top;
$(element).offset().left;
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