How i can add a alert message when i click clickme button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How i can add a alert message when i click clickme button

<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body bgcolor="red"> <h1><u>ABHIMANAM</u></h1> <ol> <li>sayooj</li> <li>simal</li> <li>juriaj</li> <li>prv</li> <li>amal</li> <li>shagil</li> </ol> <input type="button" value="clickme" onclick="button"/> </body> </html>

28th Jan 2020, 3:09 PM
Shagil Sekhar
Shagil Sekhar - avatar
3 Answers
+ 2
You can do that with a js function function abc(){ alert() } And add to the button onclick = "abc()"
28th Jan 2020, 3:22 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 1
How i can add a alert message when i click clickme button <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body bgcolor="red"> <h1><u>ABHIMANAM</u></h1> <ol> <li>sayooj</li> <li>simal</li> <li>juriaj</li> <li>prv</li> <li>amal</li> <li>shagil</li> </ol> <input type="button" value="clickme" onclick="button() "/> <script> function button () { alert("CODHACKER"); } //your code here... </script> </body> </html>
28th Jan 2020, 3:26 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <button id = "demo"> click me </button> </body> <script> x= document.getElementById("demo"); x.addEventListener("click",function (){ alert("hello world"); }); </script> </html>
28th Jan 2020, 3:43 PM
Anmol Kumar
Anmol Kumar - avatar