swal({ title: "number of players", type: "input", closeonconfirm: false, animation: "slide-from-top", }, function(inputvalue){ playersnum = number(inputvalue); if(inputvalue == 1){ swal("nice!"," ", "success") } else if(inputvalue == 2){ swal("twice nice!"," ", "success"); } else swal(":(", "enter 1 or 2 of players", "error"); }); $(".confirm:button").click(function() { alert( "testing" ); });
i have fancy code http://t4t5.github.io/sweetalert/ snippet pops dialogue box number, box has "ok" button close , proceed. once "ok" clicked, box pops cool checkmark animation , "ok" button close. these "ok" buttons being added dynamically , have same class. there way me target second "ok" button jquery or vanilla js? jquery have above targets both instances of "ok" button , such alert pops twice.
thanks help.
here demo
swal({ title: "number of players", type: "input", closeonconfirm: false, animation: "slide-from-top", }, function(inputvalue){ playersnum = number(inputvalue); if(inputvalue == 1) { swal("nice!"," ", "success"); settimeout(function() { $("button.confirm").click(function() { alert("this ok number 2"); // here want when click on seconde ok button }); },250); } else if(inputvalue == 2) { swal("twice nice!"," ", "success"); } else swal(":(", "enter 1 or 2 of players", "error"); }); $(".confirm:button").click(function() { console.log( "testing" ); });
Comments
Post a Comment