Select HTML element by CSS property value in style attribute

Viewed 4601

I have HTML like this:

…
<div style="top: 252px; left: 54px;"></div> 
<div style="top: 252px; left: 162px;"></div> 
<div style="top: 288px; left: 108px;"></div>
…

I have a JavaScript object literal like this:

var pos = { top: 252, left: 54 };

I want to select the element with the position that the object literal indicates. Positions are unique, so only one element will be selected.

Thank you for answers.

7 Answers
Related