I am wondering if mouseenter and click event can exist together and they can both exist to TRUE when checked with:
if ((evt.type === 'mouseenter') && (evt.type === 'click'))
It is because when I mouse over the link, the mouseenter triggers (set to TRUE) and even when I clicked on it, the hover is still shown. Probably they could exist together but I’m no expert on this.
If someone can give insights, I would appreciate it a lot.
Also how can I trigger the click event during the mouseenter event?
The
mouseenterevent fires when the mouse enters the control. The click event fires when the mouse is clicked. They are two separate events which call two separate event handlers. If you click just as the mouse enters the element they will be called within a short timespan of one another but they are still two distinct events.It is also important that you differentiate between the
mouseenterand themouseoverevents.mouseenterfires when the mouse physically enters an element, whereasmouseoverfires continually while the mouse remains over an element.While you cannot trigger the click event per se, you can call the same function that is called by the click event handler. For example if you have this:
Then you could simply call
myfuncdirectly and you would get the same result as if the mouse was clicked.