How you add a onclick function | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 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 Resposta
+ 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ūüĎć
17th Sep 2018, 11:23 PM
ūüĆīVincent BergerūüĆī
ūüĆīVincent BergerūüĆī - avatar