javascript - .off('click') - but i want 'click' back again -
i trying this. here in jsfiddle: http://jsfiddle.net/qgghw/2/
but after hit not now
, no more clickable next textinput.
how can this? there .on('click');
again append click event again?
appreciate help.
to remove registered handler, need pass registered event handler instance .off method.
$(document).ready(function(){ function fn(){ $(this).html('<textarea> </textarea><button class="test">save</button><button class="dont">not now</button>').off('click', fn); }; $('#write_comment').on('click', fn); $('#write_comment').on('click','.test', function(){ alert('testme'); }); $('#write_comment').on('click','.dont', function(){ console.log('d') $('#write_comment').text('click me').on('click', fn); }); });
demo: fiddle
Comments
Post a Comment