+ 1
How you add a onclick function
How do you add a onclick function so when you click it it alerts On HTML...
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