Created
November 18, 2015 20:35
-
-
Save Siyanda/08230f1b5c9500a7f1bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // adds class "foo" to el | |
| el.classList.add("foo"); | |
| // removes class "bar" from el | |
| el.classList.remove("bar"); | |
| // toggles the class "foo" | |
| el.classList.toggle("foo"); | |
| // outputs "true" to console if el contains "foo", "false" if not | |
| console.log( el.classList.contains("foo") ); | |
| // add multiple classes to el | |
| el.classList.add( "foo", "bar" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment