Say you have an html object that when you stand on (with the mouse), a menu gets opened.
You don't have to click anything, you just move the mouse on top of that HTML element (to hover on it), then just about the end of your mouse cursor, a menu will be opened.
A mouseover possible result.
My question
If I have the element's CSS selector and I targeted this way:
document.querySelector('.myElement');
How could I emulate a mouseover?
Out of curiosity tried this:
document.querySelector('.myElement').mouseover();
but I got:
TypeError: document.querySelector(...).mouseover is not a function
I expected something like this because I always saw people using click()
but not mouseover()
.
Maybe I should just do addEventListener();