How too use sweet Alert's alert function? [JavaScript library] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How too use sweet Alert's alert function? [JavaScript library]

I have been trying hard (and failing miserably) to add the sweet alerts but it doesn't work do I only have to add the link of sweet alert or do I have to do something else also?

28th May 2017, 9:29 AM
_Retr0/-
_Retr0/- - avatar
12 Answers
+ 11
https://code.sololearn.com/WguJrVB7EUMk/?ref=app this code by @Maz uses sweet alert and also includes easy instructions on how to use
28th May 2017, 10:05 PM
Burey
Burey - avatar
+ 4
wow a question unrelated to coding has so many answer and when someone asks a question related to coding no answers?
28th May 2017, 10:50 AM
_Retr0/-
_Retr0/- - avatar
+ 4
that is a more complex as you need to "wait" for answer from the confirm dialog and javascript just doesn't work this way (i searched it too, believe me xD ) the direction i can point you toward is the code below (it's something i stopped halfway thru) the usage cannot be the same as var res = confirm("are you sure?"); as the custom confirm code is executed immedietly and returns. so you need to implement a callback function (and of course pass it as a parameter) and call it once the user clicked on yes/no hope this helps.... the code is not designed but the callback logic should be understandable and easy to implement elsewhere also remember, you are not limited to callback functions, and can pass to your confirm dialog more than one callback (one for confirm, one for cancel, whatever else you wish) https://code.sololearn.com/WJFo5BEmF8hj/?ref=app
29th May 2017, 5:55 AM
Burey
Burey - avatar
+ 3
great :)
29th May 2017, 4:51 AM
Burey
Burey - avatar
+ 2
simply wow
29th May 2017, 7:25 AM
_Retr0/-
_Retr0/- - avatar
29th May 2017, 7:47 AM
_Retr0/-
_Retr0/- - avatar
+ 1
yeah😶
28th May 2017, 11:03 AM
_Retr0/-
_Retr0/- - avatar
+ 1
thanks burey I did it
29th May 2017, 4:47 AM
_Retr0/-
_Retr0/- - avatar
+ 1
@burey can you show me how make a sweet alert confirm I have searched everywhere but it doesn't work in mY code
29th May 2017, 5:34 AM
_Retr0/-
_Retr0/- - avatar
0
I think they will be changing the app's name to SocialLearn 😀
28th May 2017, 11:06 AM
_Retr0/-
_Retr0/- - avatar
0
yeah I will thx
28th May 2017, 11:09 AM
_Retr0/-
_Retr0/- - avatar
0
and there's a bug which sometimes makes the points -1
29th May 2017, 7:45 AM
_Retr0/-
_Retr0/- - avatar