Do anyone know how to make this code execute only on clicking a button? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Do anyone know how to make this code execute only on clicking a button?

https://code.sololearn.com/W0F5UVHU0Fct/?ref=app

21st Apr 2021, 1:10 PM
Shubham Mitkari
2 Answers
+ 1
First of all you need to remove the script tag from the js section.
21st Apr 2021, 7:50 PM
Goke Ekundayo
Goke Ekundayo - avatar
+ 1
Then you need to create a button in the html part: "<button onclick='//The name of the function()'>Something</button>
21st Apr 2021, 7:52 PM
Goke Ekundayo
Goke Ekundayo - avatar