0

Why can't I use the "onclick" html attribute on my phone

Why can't I use the "onclick" html attribute on my phone

15th Jul 2023, 2:59 PM
SKYD23
SKYD23 - avatar
4 Answers
+ 4
You have syntax error, because you try to nest two strings. The onclick attribute has a string value, and the alert function also has a string value. You can fix it by changing one set of quotation marks to apostrophe (single quote) instead. alert('Do you want to play?');
15th Jul 2023, 3:15 PM
Tibor Santa
Tibor Santa - avatar
+ 4
You can use onclick anywhere. It is not device specific. Maybe the problem is with the rest of your code, which you did not attach.
15th Jul 2023, 3:06 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Ok here is code. https://code.sololearn.com/WtD8il49Ve5h/?ref=app can you please check if there is any problem with it
15th Jul 2023, 3:10 PM
SKYD23
SKYD23 - avatar
+ 2
Okay I have done it. Thanks alot
15th Jul 2023, 3:36 PM
SKYD23
SKYD23 - avatar