+ 2
Why my mouseout event listener not working?
Can anyone help me understand why my mouse out even listener not working? The mouse out event listener is working well I'm using vs code on my laptop, it also not working on sololearn https://code.sololearn.com/WAr0J4W4072U/?ref=app
5 Antworten
+ 3
myDiv.addEventListener('mouseout', doSomethingElse ) // remove () , spell check lightgreen
+ 3
Jayakrishna 🇮🇳 The way OP code setting onmouseover event listening parameters is right, but your have given a wrong answer.
However BaaziM Ali you have the wrong way to set onmouseout, addEventListener parameter is a callback function pointer.
doSomething() means immediately execute the function, which should not set as addEventListenr function parameter.
so the correct way is
myDiv.addEventListener('mouseover', doSomething);
myDiv.addEventListener('mouseout', doSomethingElse);
+ 1
Jayakrishna 🇮🇳 & Calviղ
Thank you guys
I firstly didn't give the brakets but but the problem was misspelling the lightgreen word
Now it's working
+ 1
BaaziM Ali you're welcome..
Also i have to thank @ODLNT and @Calvin for noticing mistake.. credit..
0
Calviղ Yes. Thanks for letting me know. I did not checked it before. And i already corrected it, while you may typing then.
still, may not complete answer, then add your corrections.. Sry for OP, if i confused any...