Skip to content

Instantly share code, notes, and snippets.

@dacur
Created July 5, 2014 17:11
Show Gist options
  • Select an option

  • Save dacur/91ecbbe60ed183c6fc4c to your computer and use it in GitHub Desktop.

Select an option

Save dacur/91ecbbe60ed183c6fc4c to your computer and use it in GitHub Desktop.
Highlighting a button when clicked with CSS and jQuery.
$(document).ready(function () {
$('button').click(function () {
$("button").removeClass("selected"); //make sure all other
//buttons aren't highlighted
$(this).addClass("selected"); //then highlight clicked button
});
}); // end ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment