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?
16 Antworten
+ 11
https://code.sololearn.com/WguJrVB7EUMk/?ref=app
this code by @Maz uses sweet alert and also includes easy instructions on how to use
+ 4
wow a question unrelated to coding has so many answer and when someone asks a question related to coding no answers?
+ 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
+ 3
great :)
+ 2
simply wow
+ 1
yeah😶
+ 1
thanks burey I did it
+ 1
@burey can you show me how make a sweet alert confirm I have searched everywhere but it doesn't work in mY code
0
I think they will be changing the app's name to SocialLearn 😀
0
yeah I will thx
0
and there's a bug which sometimes makes the points -1