Skip to content

Instantly share code, notes, and snippets.

@ethanclevenger91
Created January 8, 2015 17:53
Show Gist options
  • Save ethanclevenger91/7d38a3cf78e74b3e1003 to your computer and use it in GitHub Desktop.
Save ethanclevenger91/7d38a3cf78e74b3e1003 to your computer and use it in GitHub Desktop.
SVG class manipulation - no IE9 support
$('svg.foo').click(function() {
this.classList.toggle('selected');
});
//classList supports add(), remove(), toggle() and contains()
//No IE9 support - shim here - https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment