I currently have a table with a few records and I am looking to implement a feature where a popup box appears when the user hovers over a specific record.
The popup box has already been created and the message has been set. The only remaining task is to position the box (
<div id="popup"></div>
) so that it appears next to the element that triggers it.
To achieve this, I need to obtain the coordinates of the element that triggered the event. However, using this.offsetLeft
gives me relative coordinates which are not helpful in my case because the element is inline.
Since I am using pure JavaScript for this project, I prefer solutions that do not involve jQuery. Any advice on how to accurately determine the location of the element would be greatly appreciated!