I need to be able to remove a function on a click event.
I have looked at the unbind and nullifying but I am unsure of the best solution, is there a destroy ability - I can't seem to find one. I need to be able to run the function again when I click .button
$('.button').on('click', function (e) {
run();
$('.back').on('click', '.back', function () {
//remove the run function
});
});
function run() {
//code
}
I have also tried nullifying the function but it doesn't remove the event fully,
run = null;
run = function () {};
Thank you