+ 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 Answers
+ 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