Skip to content

Instantly share code, notes, and snippets.

@DonSchado
Created November 19, 2011 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DonSchado/1378727 to your computer and use it in GitHub Desktop.
Save DonSchado/1378727 to your computer and use it in GitHub Desktop.
Add a click event listener on each of the button links. When clicked each toggle the class 'selected'. event.preventDefault stops the browser from following the link
$(document).ready(function(){
$('a.button').click(
function(event){
event.preventDefault();
$(this).toggleClass('selected');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment