I have textarea over a div. In the div, I highlight some parts of the text entered in the text box. I am trying to hover over events, but I cannot, because they are under my text box. I thought, if possible, using mousemove events on textarea to track the coordinates of the mouse, but then I decided that it would not do me any good, since I could not determine the exact borders if the highlighting covered.

So the question is how to simulate mouseover and mouseout events for elements that do not receive them, because they are under other elements?
EDIT:
I ended up a workaround for this, based on Marcus's answer. Full code for mouseover / mouseout events:
var mouseDown = false; var mouseIsOver = false; var lastOverElem = false; textarea.mousemove(function(e) { if (!mouseDown) { textarea.hide(); var elm = $(document.elementFromPoint(e.pageX, e.pageY)); textarea.show(); if (elm.hasClass("highlighted")) { if (!mouseIsOver) { mouseIsOver = true; } } else { if (mouseIsOver) { mouseIsOver = false; if (lastOverElem) { } } } } }); $('body').mousedown (function () {mouseDown = true;}); $('body').mouseup (function () {mouseDown = false;});
source share