Skip to content

Instantly share code, notes, and snippets.

@logeshpaul
Created July 1, 2014 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save logeshpaul/69db97f730b858d239c2 to your computer and use it in GitHub Desktop.
Save logeshpaul/69db97f730b858d239c2 to your computer and use it in GitHub Desktop.
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() {
$(this).unbind('click');
alert('Clicked and unbound!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment