Skip to content

Instantly share code, notes, and snippets.

@enopanen
Created December 3, 2013 18:02
Show Gist options
  • Save enopanen/7774227 to your computer and use it in GitHub Desktop.
Save enopanen/7774227 to your computer and use it in GitHub Desktop.
Adding and removing CSS classes on HTML elements is another fairly common action. This is one technique you may consider with selected menu items, highlighted rows, or active input elements. This newer method is simply quicker than using .addClass() and .removeClass() where you can put all the code into one function call.
$('nav a').toggleClass('selected');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment