views:

51

answers:

2

I'm looking to identify the target DOM element at a specified location. For example, I want to say, give me the element at offset 200px from the top and 150px from the left. This needs to be done programatically, and not via an event (for example, it should be able to return the element when the page loads)

For extra points, would it be possible to identify a word or string of words at a specified location?

Is there an easy way to do this using jQuery?

Target: I would like to dynamically insert a div into this location and float it right.

A: 

There is nothing built into JavaScript that gets an element by position. Only way to identify elements by posiition would be to map every element on the page with its x,y,z position and figure out what is at the point. Possible, but performance would probably be bad.

epascarello