I need your quick help. I have a list of 'li'. I have 10 LIs In the UL. I need to get how many pixel every LI is away from left(UL).
Thanks :)
I need your quick help. I have a list of 'li'. I have 10 LIs In the UL. I need to get how many pixel every LI is away from left(UL).
Thanks :)
If I understand you correctly you'd like to iterate through each li and get its left offset.
Demo: http://jsfiddle.net/LkTdD/
HTML
<ul>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
</ul>
jQuery
$(function(){
$('li').each(function(index,el){
var offset = $(el).offset();
var html = $(el).html();
$(el).html(html + ' ' + offset.left);
});
});
Best regards,