Dirk Dirk - 2 months ago 7
HTML Question

Relative position of a table column HTML / JQuery

I want to hover over a table element, and display a popup box in a position exactly to the right of the element.

I can display the popup correctly according to the position of my mouse coordinates, but I'd like the coordinates to not move, i.e., I'd like to position the popup box according to the table element's coordinates.

So my question is: how do I find the location of a specific column in a table? Pixels or % are both okay.

Answer

You can use position() which returns left and top positions:

$('td').position();