+ 1

How you add a onclick function

How do you add a onclick function so when you click it it alerts On HTML...

17th Sep 2018, 9:42 PM
Little Cupcake
Little Cupcake - avatar
1 Réponse
+ 1
Use the attribute onclick to call the JS function after the onclick event is executed: onclick="myFunction();" The onclick attribute can be applied to many HTML tags👍 F.E.: In JS u create a function myFunction() that executes the code related to the function. function myFunction() { alert ("You clicked me!"); } Hope it helps👍 https://code.sololearn.com/WZbaGOdCDWA6/?ref=app
17th Sep 2018, 11:23 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar