craftpip / jquery-confirm

A multipurpose plugin for alert, confirm & dialog, with extended features.

Home Page:http://craftpip.github.io/jquery-confirm/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

duplication problem

instagramlover opened this issue · comments

I am using this selector ( onmousedown ontouchend ) , some time the pop up show twice on mobile and some time on pc
using jquery-confirm v3.2.0

I want to update to jquery-confirm v3.2.3 but i am not sure if that will break anything , so i want to be sure
1- how prevent duplication of the pop up
2- is it a bug
3- can i upgrade safely

Regards

Please post your code for clear understanding,

commented

I had kind of the same problem. :) I solved it in a bit hacky way:

$(".confirm-delete:not(.haveConfirmAttached)").confirm({
      ...
}).addClass("haveConfirmAttached");

I load content into a table via Ajax (jQuery Datatables) due to paging and need to add a confirmation dialog to the [Delete] button for each row. The problem I had was that confim() did attach multiple click events (and triggered multiple confirm dialog when hitting a button). This is due to elements in the table do stick around for each page.

It could be solved by adding a option like attachOnlyOnce: true maybe. :)

i dont like this way , the author of the lib has to provide a fix for this with big Thanks for hem for sure !

Thanks for pointing the issue @snap608 , i should be checking if the events are already binded. Will fix asap.

@instagramlover

  1. as @snap608 pointed out, its because multiple events are attached, this is to be fixed.
  2. Yes, its a bug
  3. Yes, look for the changes that were made between the versions.
    If the changes are breaking older versions i will surely point it out in the release notes.

Dear @craftpip , please can you explain this :


function popupalert(title, text, reload) {
      $.alert({
          title: title,
          content: text,
          confirmButton: 'Ok',
          boxWidth: '30%',
          useBootstrap: false,
          icon: 'ui large red warning circle icon',
          animation: 'zoom',
          buttons: {
              close: {
                  btnClass: 'btn-blue',
                  action: function() {
                      if (reload) {
                          location.reload();
                      }
                  }
              }
          }
      })
  }


$(".globalbody").on("touchend mousedown", ".add_mor_time_sign", function() {
              popupalert('Error!', 'There is no enough time in your global account balance Please <b><a href="https://instaranker.com/prices/">Buy more time</a></b>!', false);
  })

the problem still available !