Rectification :
With unbind in the yes click handler, the Yes button doesn't work
anymore the second time the code is triggered. First time it is
working ok.

Mike,

I found the solution but I don't understand it :
If I move the $.blockUI() call to the beginning of the
$(".a_delete").click handler then it works. Unbinding click even is
needed in order to avoid click event stacking. (it was not happening
before moving $.blockUI()

So the working code looks like this :

$(document).ready(function() {
      var modal = $("#modal_yesno")[0];
      $(".a_delete").css("cursor", "pointer").click(function() {
              $.blockUI(modal, { width: '275px' });
              var tr = $(this).parent().parent();
              var id = $(tr).attr("id").replace("item_", "");
              console.log(id);        // first console log
              $("#modal_yes").click(function() {
                      console.log(id);        // second console log
                      $.unblockUI();
                      $(this).unbind('click');
              });
              $("#modal_no").click($.unblockUI);
      });
});


Does it make sense to you ?

The only thing I see would be that blockUI does clone the modal div,
and that things are messed up because events are registered before
this clone() or something like that.

--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]

Reply via email to