javascript - How to deactivate a nested anonymous function in Jquery -
i have following code:
$('#button-a').click(function(){ $('#button-b').click(function(){ alert('something'); }); }); $('#button-b').click(function(){ // });
how can deactivate nested #button-b function after have clicked #button-a, last #button-b function (not nested) activates when click #button-b , not them both?
try using .on()
, .off()
event handlers.
$('#button-a').click(function(){ $('#button-b').off('click'); //unbind click event of #button-b $('#button-b').click(function(){ alert('something'); }); }); $('#button-b').on('click',function(){ // });
Comments
Post a Comment