With using .off(), .on() Function Still Runs
I'm trying to remove the function and event that was added dynamically to an anchor tag. With this line:
- $(document).on("click", "a.like-command", function() {
- likeFunction($(this));
- return false;
-
- });
- function likeFunction(tagele) {
- $.ajax(){
-
- //gets some stuff from server
- }.done(function (data) {
- //delete the event handler so this function can't be called anymore
- comment_div.find("div.command-area div.like a").off('click', this, false);
- });
- }
The element it's attached too is correct w/ line 12. Any idea as to why this doesn't work?