My DOM
structure is as follows,
<a id='c_1' class='like'>Like</a>
<a id='c_2' class='like'>Like</a>
<a id='c_3' class='like'>Like</a>
......
Binding click
event as follows,
$(document).on("click",".like",function(){
var selector = $(this);
saveLikes(selector);
});
saveLikes(selector)
have Ajax
call,on success
of Ajax
call I want to remove/unbind click
event on currently clicked element for that I've written following code in success
callback.
$(document).off("click",selector);
It's not working and I'm able to remove click
event by $(document).off("click",".like");
but I don't want this because further clicks on other elements will not fire the event.
Is their any solution to remove event on current element only that too without changing class name ?