I have two click functions, on function is for adding vacation in a list, the other function is for removing vacation from the list. When I add vacation to the list, I dont want to be able to click on that specifik button again .vacation-btn. If I remove specifik vacation from the list, then I want to be able to click that .vacation-btn again. I have tried with jQuery(this).off('click'); and Its working, but then when I remove vacation from the list I want to add the click event again.
jQuery("tr td .list").live('click', function(e) {
var test = jQuery(this).closest('tr');
jQuery(test).remove();
});
jQuery(".vacation-btn").on('click', function(event) {
var id = jQuery(this).attr('id');
event.stopImmediatePropagation();
});