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

alert box

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

28th Dec 2017, 3:58 PM
NJUGUNA MUIRURI
NJUGUNA MUIRURI - avatar
5 Answers
0
sure there is,,, just change the content inside the parentheses if the alert box
23rd Apr 2018, 9:36 AM
NJUGUNA MUIRURI
NJUGUNA MUIRURI - avatar
+ 3
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 :)
28th Dec 2017, 4:40 PM
Jeric So
Jeric So - avatar
+ 1
alert("hello Muiruri")....try alerting some texts in ur text editor
28th Dec 2017, 4:30 PM
Android Boi
Android Boi - avatar
0
mack ti
13th Apr 2018, 2:21 PM
abdelkader khannouss
abdelkader khannouss - avatar
- 1
alert("Some text!"). did you mean like you want to change the message display in the alert box?
28th Dec 2017, 4:22 PM
Jeric So
Jeric So - avatar