How can I create an alert box or swal alert by clicking a button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I create an alert box or swal alert by clicking a button

24th Oct 2020, 6:23 AM
Løgîstïçs
Løgîstïçs - avatar
5 Answers
+ 2
Follow these Steps 1. Make a html alert box using div tags and make an ok button inside it. 2. Make a function to hide and unhide the alert box 3. Attach that function to ok button using onclick attribute ex : https://code.sololearn.com/W6FnA55U6uDV/?ref=app
24th Oct 2020, 6:28 AM
Abhay
Abhay - avatar
24th Oct 2020, 6:38 AM
Oma Falk
Oma Falk - avatar
+ 1
Thanks guys
24th Oct 2020, 6:38 AM
Løgîstïçs
Løgîstïçs - avatar
0
I don't know about swal but I know alert using button clicking by javascrypt. Vary simple. Like this 👇. Copy and paste your html file <Button onclick="click ()">button name</name> Copy and paste javascrypt file Function click(){ Alert("your alert massege"); }
25th Oct 2020, 8:18 AM
Hriday Kalita