Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 qunit
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.markdown
Octocat-spinner-32 changelog
Octocat-spinner-32 jquery.classlist.js


Provides an interface for handling class attributes as arrays of className strings:

Performance Evidence

Array of Classes Survey



  • .classlist( )
  • .classlist( ["set", "this", "array", "of", "classes"] )


Elements may have more than one class assigned to them. In HTML, this is represented by separating the class names with a space:

<div id="mydiv" class="foo bar baz quux"></div>

The .classlist() method will return an array of classes on first element of the matched elements:


Get an array of all classes on an element $('#mydiv').classlist() > [ "foo", "bar", "baz", "quux" ]

The .classlist( [ "foo", "bar", "baz" ] ) method will take an array of class strings and apply them to all the elements in the matched set:

.classlist( [ "foo", "bar", "baz" ] )

Set classes on elements with an array of strings, returns the matched set $('#mydiv').classlist([ "foo", "bar", "baz", "quux" ]) > [ div#mydiv ]
Something went wrong with that request. Please try again.