0

I want to get an element that is at this position .How can I do this ?

<div class="parent">
    <div id="pos1" style="left:0;top:0">pos1</div>
 <div id="pos2" style="left:100px;top:100px">pos2</div>
  <div id="pos3" style="left:100px;top:100px">pos3</div>
</div>

css

.parent{position:relative}
.parent div{position:absolute}

Now if I want to get all elements at position 100px,100px.. How can I do it using jquery ?

Manish Basdeo
  • 6,139
  • 22
  • 68
  • 102

1 Answers1

2

You could use .filter (as seen here jQuery: Selecting all elements where attribute is greater than a value)

Something like:

$('.parent div').filter(function() {
  return ( $(this).css('top') == '100px' && $(this).css('left') == '100px')
});
Community
  • 1
  • 1
gherkins
  • 14,603
  • 6
  • 44
  • 70