Click Once and Unbind


Have something happen on a click event, but only once! Unbind the click handler after the element has been clicked once.

$('#my-selector').bind('click', function() {
       alert('Clicked and unbound!');

Also see Ben’s comment below for jQuery’s .one() function which is essentially the same thing.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.