+ 2

onclick & function

Why "y.onclick=function cfr()" not working? Am I not correctly calling the function? https://code.sololearn.com/WaW0uMFEgKb1/?ref=app

24th Dec 2017, 11:58 AM
Илья Ланин
Илья Ланин - avatar
3 odpowiedzi
+ 2
Use y.addEventListener("click",cfr); or y.onclick=cfr; instead of y.onclick=cfr();
24th Dec 2017, 1:39 PM
Mohammed Hany
Mohammed Hany - avatar
+ 1
thank you, Mohammed!
24th Dec 2017, 3:24 PM
Илья Ланин
Илья Ланин - avatar
+ 1
You're welcome, Илья
24th Dec 2017, 3:46 PM
Mohammed Hany
Mohammed Hany - avatar