+ 8

[SOLVED] Onclick not working

https://code.sololearn.com/WA5A7a16a102/?ref=app When we click at the box in the app it works perfectly But when we try to run the same code on laptop (website) it doesn't work :(

22nd Apr 2021, 4:33 PM
Namit Jain
Namit Jain - avatar
12 Answers
+ 2
David Dolejší It appears that SL is using the IIFE (website only) to solve the problem you were referring to in your first response to this post, but doing so has caused Namit Jain [INACTIVE] issue/bug where the function func is not globally scoped as it would normally be without the IIFE, see Sofi (DM Closed❌) 's code. Another way to solve this is to use a function expression instead of function declaration, ex window.func = function(){...}.
23rd Apr 2021, 4:39 AM
ODLNT
ODLNT - avatar
22nd Apr 2021, 5:12 PM
Սոֆի
+ 5
22nd Apr 2021, 5:18 PM
Սոֆի
+ 3
Thank you so so much Sofi (DM Closed❌) 🙏🙏 I have been stuck on it for more than 2 hours. And now it's working perfectly 😃
22nd Apr 2021, 5:16 PM
Namit Jain
Namit Jain - avatar
+ 3
Ohh, I should have elaborated my question better. But Sofi (DM Closed❌) understood the problem and came up with the solution Thanks to her again :)
22nd Apr 2021, 5:34 PM
Namit Jain
Namit Jain - avatar
+ 2
Yeahh same :(
22nd Apr 2021, 5:02 PM
Namit Jain
Namit Jain - avatar
+ 1
Ohh I see 🧐🤔 Thanks for that! 👍✌
22nd Apr 2021, 5:49 PM
Namit Jain
Namit Jain - avatar
+ 1
ODLNT that worked! Thank you so much✌:) I wish we had the option to mark 2 answers as best...
23rd Apr 2021, 4:57 AM
Namit Jain
Namit Jain - avatar
+ 1
Namit Jain [INACTIVE] wlcm again😆
23rd Apr 2021, 11:44 AM
Սոֆի
- 1
Itha konjam soldra punda
24th Apr 2021, 11:22 AM
VDR GAMING yt
VDR GAMING yt - avatar