+ 3

How can I specify what will happen after a button was clicked?

When I was reading a HTML lesson, I saw a paragraph containing a "<button>" word. Then I entered the Code Playground and wrote an experimental (private) code. I want to specify what will happen when the button was pressed. Could someone help me with this?

16th Apr 2018, 6:50 AM
Ibaadi Jaya
Ibaadi Jaya - avatar
2 Respuestas
+ 5
You're halfway through the JavaScript course. Complete it and you will get what you need :) https://www.sololearn.com/learn/JavaScript/2758/ (only if you're too lazy :P)
16th Apr 2018, 7:14 AM
Dev
Dev - avatar
+ 4
<button onclick="doSomething()" > </button> function doSomething(){ alert("hello"); //specify what you wantcto happen }
16th Apr 2018, 7:15 AM
᠌᠌Code X
᠌᠌Code X - avatar