小编Ste*_*ven的帖子

jQuery.off()没有删除绑定

出于某种原因,jQuery.off('click')似乎没有在这里工作.当在模型中单击"是"按钮时,会弹出另一个模型.我究竟做错了什么?

码:

$(function(){

  //If there are warnings on the page bind alert
  if ($('.renewal-warning').length > 0){

    (function (){

      $('#signRentalContainer').on('click', '.renewal-warning', function(e){

        var buttonHandle = this;

        //Prevent submission
        e.preventDefault();

        //Show warning model
        $.modal({
          content: $('#renewalWarning').html(),
          title: "Order Renewal Warning",
          buttons: {
            'Yes': function(win) { $(buttonHandle).off('click').click(); },
            'No': function(win) { win.closeModal(); }
          },
          maxWidth: 250,
          closeButton: false
        });
      });
    })();
  }
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

javascript ×1

jquery ×1