alert box | Sololearn: Learn to code for FREE!


alert box

is there a way to change the message displayed by alert box?

12/28/2017 3:58:14 PM


5 Answers

New Answer


sure there is,,, just change the content inside the parentheses if the alert box


maybe you can try this on your editor -->> =====HTML: <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <button id="one" onclick="hi();">Hi, Welcome</button> <button id="two" onclick="bye();">Goodbye</button> </body> </html> =====CSS: button { outline: none; border: none; padding: 5px; cursor: pointer; border-radius: 5px; } button:active { transform: translateY(3px); } #one { background: green; } #two { background: red; } =====JS: function hi() { var hiBtn = document.getElementById("one"); hiBtn.onclick = function() { alert("Welcome"); } } function bye() { var byeBtn = document.getElementById("two"); byeBtn.onclick = function() { alert("Goodbye!"); } } Hope this will answer your question :)


alert("hello Muiruri")....try alerting some texts in ur text editor



alert("Some text!"). did you mean like you want to change the message display in the alert box?