I can't quite get this to work. Please help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I can't quite get this to work. Please help!

https://code.sololearn.com/WhXoPlP1FUHR/?ref=app I want this code to when you click the apples button, it shows you the price. I am sure it's just a simple mistake, but help would be very appreciated. Thanks!

28th Jul 2017, 9:06 PM
Samantha Hammes
Samantha Hammes - avatar
3 Answers
+ 1
the problem could be that javascript is executed before the button is created try to write onclick in the button tag and declare the function in js code like this https://code.sololearn.com/Wu6VZ7xBC9ww/?ref=app
28th Jul 2017, 9:48 PM
Matte
Matte - avatar
+ 2
Omg. Thank you so much @matte
28th Jul 2017, 10:03 PM
Samantha Hammes
Samantha Hammes - avatar
+ 1
you're welcome :)
28th Jul 2017, 10:08 PM
Matte
Matte - avatar