jQuery click() still being triggered after .clickable class is removed

后端 未结 7 807
时光说笑
时光说笑 2020-12-03 05:29

I\'ve got a click event assigned to a div of a particular class. When the click occurs, the class is removed from the div. However, you can still click the div and the

7条回答
  •  悲哀的现实
    2020-12-03 05:34

    unbind click event - like $(this).unbind('click');' Try this

    $('.clickable').click(function() {
      $(this).removeClass('clickable');
      $(this).addClass('not-clickable');
      $(this).unbind('click');'
    });
    

提交回复
热议问题