Allow just one click in class JQUERY

后端 未结 2 483
日久生厌
日久生厌 2020-12-12 01:03

I have a link that will load via ajax some content.

My problem is, I don\'t want to remove the text \"Load comments\", I just want to not allow more clicks in this c

2条回答
  •  抹茶落季
    2020-12-12 02:01

    When you bind an event handler, you bind to the element, not to the class. Removing a class from an element doesn't change which event handlers are bound to the element.

    You could use off() to remove the event handler:

    $(this).off('click');

    http://jsfiddle.net/om6ggvyu/

提交回复
热议问题