Click here to Skip to main content
15,900,589 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I'm trying to display confirm pop up while button click.here button click function in pure javascript,but confirm pop up is jquery format.so pop up not opening.

What I have tried:

Jquery-confirm plugin

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.3/jquery-confirm.min.js"></script>



Script code
var el = document.getElementsByClassName("cancel");
          for (var i = 0; i < el.length; i++) {
              el[i].addEventListener('click', function (e) {


                  $.confirm({
                      animation: 'zoom',
                      closeAnimation: 'scale'
                  });



                  e.preventDefault();
              });
          }
Posted
Updated 14-Jul-17 4:56am
v2
Comments
Richard Deeming 14-Jul-17 9:03am    
So long as you've included a reference to the jQuery script file, any jQuery plugins will just work.

If you don't want to include jQuery in your page for some reason, then you'll need to use an alternative script that doesn't rely on jQuery.
GrpSMK 14-Jul-17 9:18am    
$.confirm({
animation: 'zoom',
closeAnimation: 'scale'
});

this part only not working,if add alert means working
Richard Deeming 14-Jul-17 9:28am    
As I said, you need to include the jQuery script in your page:
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>

jQuery CDN[^]
GrpSMK 14-Jul-17 9:39am    
Not working
Richard Deeming 14-Jul-17 9:43am    
Well, thanks for that extremely detailed and helpful description of the problem you're facing. </SARCASM>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900