Styled/Sweet Alert in js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Styled/Sweet Alert in js

How to add a styled Alert in a website by using swal. And even that tick mark circling animation. How to use different types of sweet alert? How to use swal? What does it means}?

6th Aug 2020, 5:01 PM
Tanmay Gupta
Tanmay Gupta - avatar
11 Answers
+ 16
Use this inside your code it will help you <head> <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"> </script> </head> <body> <script> swal("thanks for visiting my code; don't forgot to upvote") </script> </body> Don't forgot to use swal inside body otherwise it produce an error
6th Aug 2020, 5:10 PM
ANMOL
ANMOL - avatar
+ 9
Swal is sweet alert which makes it decorative To use it you have to do this <script src=" "></script> <script> swal(" any text")</script>
6th Aug 2020, 5:16 PM
Harsh
Harsh - avatar
+ 5
Thanks Anmol Singh Harsh Divya Mohan for your help.
7th Aug 2020, 1:53 AM
Tanmay Gupta
Tanmay Gupta - avatar
+ 4
This link helped me!! https://sweetalert.js.org/guides/
7th Aug 2020, 11:56 AM
Tanmay Gupta
Tanmay Gupta - avatar
+ 3
There is also something like check in the alert how to do that like in this code https://code.sololearn.com/We32oj07HPmq/?ref=app
7th Aug 2020, 1:55 AM
Tanmay Gupta
Tanmay Gupta - avatar
+ 3
Divya Mohan may you please send a private code I didn't understand how to do
7th Aug 2020, 3:18 AM
Tanmay Gupta
Tanmay Gupta - avatar
+ 3
No the first parameter should be title, Second parameter will be message, Third parameter will be type of alert.(success,warning,error,nfo) So better if you write first parameter which you want to be heading of alert box. https://sweetalert.js.org/guides/
7th Aug 2020, 3:30 AM
Divya Mohan
Divya Mohan - avatar
+ 2
Where is code😳😳🧐🧐
6th Aug 2020, 5:04 PM
Divya Mohan
Divya Mohan - avatar
+ 2
You can even change button text also. https://code.sololearn.com/WORg3d1DiZ8I/?ref=app
6th Aug 2020, 6:47 PM
Divya Mohan
Divya Mohan - avatar
+ 2
For check put the value of type:"success"
7th Aug 2020, 2:42 AM
Divya Mohan
Divya Mohan - avatar
+ 2
Just change the value of type in swal fxn one by one to success error info warning.
7th Aug 2020, 3:19 AM
Divya Mohan
Divya Mohan - avatar