Onclick | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2


How do you make a button disappear once clicked?

1st Jul 2018, 2:49 PM
George - avatar
2 Answers
+ 1
<button onclick='this.style.display="none";'> Dont click me please </button>
1st Jul 2018, 4:40 PM
KrOW - avatar
+ 2
Hello, George ! The easiest way to hang an onclick event is to register it directly in the html tag: <a href="#" onclick="alert( 'Example 1 worked'); return false;"> Example 1</a> https://www.sololearn.com/learn/JavaScript/2758/?ref=app
1st Jul 2018, 3:04 PM
Alexander Sokolov
Alexander Sokolov - avatar