+ 1

Can you design JavaScript alert box?

Can you design JavaScript alert, prompt, etc using css or anything else?

5th Sep 2020, 2:08 AM
ßØNK
4 Respostas
+ 7
<!DOCTYPE html> <html> <body> <h2>JavaScript Prompt</h2> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var txt; var person = prompt("Please enter your name:", "Alert box"); if (person == null || person == "") { txt = "User cancelled the prompt."; } else { txt = "Hello " + person + "🐍🐍🐍"; } document.getElementById("demo").innerHTML = txt; }</script> </body> </html>
5th Sep 2020, 2:24 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Amnehileisie hi, If not, a solution would be to make your custom one using <dialog> tags in html, then styling it in CSS and controling it through js : https://alligator.io/html/dialog-element/ https://blog.logrocket.com/the-dialog-element-the-way-to-create-tomorrows-modal-windows-f1d4ab14380b/
5th Sep 2020, 2:47 AM
EmmanueLZ.
EmmanueLZ. - avatar
0
No you can't in sololearn. You can use sweetalert alerts for designed alert. https://code.sololearn.com/WORg3d1DiZ8I/?ref=app
5th Sep 2020, 2:59 AM
Divya Mohan
Divya Mohan - avatar
0
Use Google sweet alert by looking at w3school Website for a better practical application.
5th Sep 2020, 5:03 AM
shubham kumar
shubham kumar - avatar