I’m using the following code:
var divWithTopLeft = null;
var maxLeft = 0;
$('.place').each(function(){
left = this.style.left.replace('px','');
if(left > maxLeft )
{
maxLeft = left;
divWithTopLeft = this;
}
});
alert(divWithTopLeft.style.left);
But, it’s work not properly. For my makrup it returns 85. But, there are divs with 220 and more. Can you explain me why?
Demo
Thanks.
You have to convert them to a number first:
Here’s your fiddle: http://jsfiddle.net/UAYWD/2/