How to make an “if button is pressed do this” | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to make an “if button is pressed do this”

I want to make that when you press a button everything fadeOut and appear other Things like codes or images but if not stay my first codes. Two people explain me but I don’t understand. Please explain me with too much detail or senda me a YouTube link.

9th Mar 2018, 9:46 PM
Octavio Aguayo
Octavio Aguayo - avatar
3 Answers
+ 8
@Jayden LeCorps Yeah, but what about without html ( onclick="" ... ) ? Ps: Are you french ? ^^
10th Mar 2018, 11:44 PM
Chalza
Chalza - avatar
0
<button id="burrito">Burrito!</button> <script> function burrito_machine(){alert("BURRITO FOR THE VICTORY");} button1 = document.body.getElementById("burrito"); button1.onclick = burrito_machine();</script>
17th Mar 2018, 2:11 PM
Arda Aydın
Arda Aydın - avatar
0
there u go @VapeHorization
17th Mar 2018, 2:11 PM
Arda Aydın
Arda Aydın - avatar