🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 53 (from laksa078)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

đź“„
INDEXABLE
âś…
CRAWLED
1 day ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://developer.mozilla.org/en-US/docs/Web/API/Element/classList
Last Crawled2026-04-07 02:41:26 (1 day ago)
First Indexed2015-03-10 15:11:56 (11 years ago)
HTTP Status Code200
Meta TitleElement: classList property - Web APIs | MDN
Meta DescriptionThe read-only classList property of the Element interface contains a live DOMTokenList collection representing the class attribute of the element. This can then be used to manipulate the class list.
Meta Canonicalnull
Boilerpipe Text
Value A DOMTokenList object representing the contents of the element's class attribute. If the class attribute is not set or empty, it returns an empty DOMTokenList , i.e., a DOMTokenList with the length property equal to 0 . Although the classList property itself is read-only in the sense that you can't replace the DOMTokenList object, you can still assign to the classList property directly, which is equivalent to assigning to its value property. You can also modify the DOMTokenList object using the add() , remove() , replace() , and toggle() methods. Examples js const div = document.createElement("div"); div.classList = "foo"; // forwarded to classList.value // our starting state: <div class="foo"></div> console.log(div.outerHTML); // use the classList API to remove and add classes div.classList.remove("foo"); div.classList.add("another-class"); // <div class="another-class"></div> console.log(div.outerHTML); // if visible is set remove it, otherwise add it div.classList.toggle("visible"); // add/remove visible, depending on test conditional, i less than 10 div.classList.toggle("visible", i < 10); // false console.log(div.classList.contains("foo")); // add or remove multiple classes div.classList.add("foo", "bar", "baz"); div.classList.remove("foo", "bar", "baz"); // add or remove multiple classes using spread syntax const cls = ["foo", "bar"]; div.classList.add(...cls); div.classList.remove(...cls); // replace class "foo" with class "bar" div.classList.replace("foo", "bar"); Specifications Specification DOM # ref-for-dom-element-classlistâ‘  Browser compatibility See also Element.className DOMTokenList
Markdown
- [Skip to main content](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#content) - [Skip to search](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#search) HTML [HTML: Markup language](https://developer.mozilla.org/en-US/docs/Web/HTML) HTML reference - [Elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements) - [Global attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes) - [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes) - [See all…](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference "See all HTML references") HTML guides - [Responsive images](https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Responsive_images) - [HTML cheatsheet](https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Cheatsheet) - [Date & time formats](https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Date_and_time_formats) - [See all…](https://developer.mozilla.org/en-US/docs/Web/HTML/Guides "See all HTML guides") Markup languages - [SVG](https://developer.mozilla.org/en-US/docs/Web/SVG) - [MathML](https://developer.mozilla.org/en-US/docs/Web/MathML) - [XML](https://developer.mozilla.org/en-US/docs/Web/XML) CSS [CSS: Styling language](https://developer.mozilla.org/en-US/docs/Web/CSS) CSS reference - [Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties) - [Selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors) - [At-rules](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules) - [Values](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values) - [See all…](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference "See all CSS references") CSS guides - [Box model](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Box_model/Introduction) - [Animations](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Animations/Using) - [Flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Flexible_box_layout/Basic_concepts) - [Colors](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Colors/Applying_color) - [See all…](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides "See all CSS guides") Layout cookbook - [Column layouts](https://developer.mozilla.org/en-US/docs/Web/CSS/How_to/Layout_cookbook/Column_layouts) - [Centering an element](https://developer.mozilla.org/en-US/docs/Web/CSS/How_to/Layout_cookbook/Center_an_element) - [Card component](https://developer.mozilla.org/en-US/docs/Web/CSS/How_to/Layout_cookbook/Card) - [See all…](https://developer.mozilla.org/en-US/docs/Web/CSS/How_to/Layout_cookbook) JavaScriptJS [JavaScript: Scripting language](https://developer.mozilla.org/en-US/docs/Web/JavaScript) JS reference - [Standard built-in objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects) - [Expressions & operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators) - [Statements & declarations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements) - [Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions) - [See all…](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference "See all JavaScript references") JS guides - [Control flow & error handing](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling) - [Loops and iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration) - [Working with objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_objects) - [Using classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_classes) - [See all…](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide "See all JavaScript guides") Web APIs [Web APIs: Programming interfaces](https://developer.mozilla.org/en-US/docs/Web/API) Web API reference - [File system API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) - [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) - [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API) - [HTML DOM API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API) - [Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) - [Service worker API](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) - [See all…](https://developer.mozilla.org/en-US/docs/Web/API "See all Web API guides") Web API guides - [Using the Web animation API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Using_the_Web_Animations_API) - [Using the Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) - [Working with the History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API/Working_with_the_History_API) - [Using the Web speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API/Using_the_Web_Speech_API) - [Using web workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) All [All web technology](https://developer.mozilla.org/en-US/docs/Web) Technologies - [Accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility) - [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP) - [URI](https://developer.mozilla.org/en-US/docs/Web/URI) - [Web extensions](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions) - [WebAssembly](https://developer.mozilla.org/en-US/docs/WebAssembly) - [WebDriver](https://developer.mozilla.org/en-US/docs/Web/WebDriver) - [See all…](https://developer.mozilla.org/en-US/docs/Web "See all web technology references") Topics - [Media](https://developer.mozilla.org/en-US/docs/Web/Media) - [Performance](https://developer.mozilla.org/en-US/docs/Web/Performance) - [Privacy](https://developer.mozilla.org/en-US/docs/Web/Privacy) - [Security](https://developer.mozilla.org/en-US/docs/Web/Security) - [Progressive web apps](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps) Learn [Learn web development](https://developer.mozilla.org/en-US/docs/Learn_web_development) Frontend developer course - [Getting started modules](https://developer.mozilla.org/en-US/docs/Learn_web_development/Getting_started) - [Core modules](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core) - [MDN Curriculum](https://developer.mozilla.org/en-US/curriculum/) - [Check out the video course from Scrimba, our partner](https://scrimba.com/frontend-path-c0j?via=mdn-learn-navbar) Learn HTML - [Structuring content with HTML module](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Structuring_content) Learn CSS - [CSS styling basics module](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics) - [CSS layout module](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/CSS_layout) Learn JavaScript - [Dynamic scripting with JavaScript module](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting) Tools Discover our tools - [Playground](https://developer.mozilla.org/en-US/play) - [HTTP Observatory](https://developer.mozilla.org/en-US/observatory) - [Border-image generator](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Backgrounds_and_borders/Border-image_generator) - [Border-radius generator](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Backgrounds_and_borders/Border-radius_generator) - [Box-shadow generator](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Backgrounds_and_borders/Box-shadow_generator) - [Color format converter](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Colors/Color_format_converter) - [Color mixer](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Colors/Color_mixer) - [Shape generator](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Shapes/Shape_generator) About Get to know MDN better - [About MDN](https://developer.mozilla.org/en-US/about) - [Advertise with us](https://developer.mozilla.org/en-US/advertising) - [Community](https://developer.mozilla.org/en-US/community) - [MDN on GitHub](https://github.com/mdn) [Blog](https://developer.mozilla.org/en-US/blog/) 1. [Web](https://developer.mozilla.org/en-US/docs/Web) 2. [Web APIs](https://developer.mozilla.org/en-US/docs/Web/API) 3. [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) 4. [classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList) # Element: classList property Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2017. - [Learn more](https://developer.mozilla.org/en-US/docs/Glossary/Baseline/Compatibility) - [See full compatibility](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#browser_compatibility) - [Report feedback](https://survey.alchemer.com/s3/7634825/MDN-baseline-feedback?page=%2Fen-US%2Fdocs%2FWeb%2FAPI%2FElement%2FclassList&level=high) The read-only **`classList`** property of the [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element) interface contains a live [`DOMTokenList`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList) collection representing the `class` attribute of the element. This can then be used to manipulate the class list. Using `classList` is a convenient alternative to accessing an element's list of classes as a space-delimited string via [`element.className`](https://developer.mozilla.org/en-US/docs/Web/API/Element/className). ## In this article - [Value](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#value) - [Examples](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#examples) - [Specifications](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#specifications) - [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#browser_compatibility) - [See also](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#see_also) ## [Value](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#value) A [`DOMTokenList`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList) object representing the contents of the element's `class` attribute. If the `class` attribute is not set or empty, it returns an empty `DOMTokenList`, i.e., a `DOMTokenList` with the `length` property equal to `0`. Although the `classList` property itself is read-only in the sense that you can't replace the `DOMTokenList` object, you can still assign to the `classList` property directly, which is equivalent to assigning to its [`value`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/value "value") property. You can also modify the `DOMTokenList` object using the [`add()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add "add()"), [`remove()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove "remove()"), [`replace()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/replace "replace()"), and [`toggle()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle "toggle()") methods. ## [Examples](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#examples) js ``` const div = document.createElement("div"); div.classList = "foo"; // forwarded to classList.value // our starting state: <div class="foo"></div> console.log(div.outerHTML); // use the classList API to remove and add classes div.classList.remove("foo"); div.classList.add("another-class"); // <div class="another-class"></div> console.log(div.outerHTML); // if visible is set remove it, otherwise add it div.classList.toggle("visible"); // add/remove visible, depending on test conditional, i less than 10 div.classList.toggle("visible", i < 10); // false console.log(div.classList.contains("foo")); // add or remove multiple classes div.classList.add("foo", "bar", "baz"); div.classList.remove("foo", "bar", "baz"); // add or remove multiple classes using spread syntax const cls = ["foo", "bar"]; div.classList.add(...cls); div.classList.remove(...cls); // replace class "foo" with class "bar" div.classList.replace("foo", "bar"); ``` ## [Specifications](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#specifications) | Specification | |---| | [DOM \# ref-for-dom-element-classlist①](https://dom.spec.whatwg.org/#ref-for-dom-element-classlist%E2%91%A0) | ## [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#browser_compatibility) ## [See also](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#see_also) - [`Element.className`](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) - [`DOMTokenList`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList) ## Help improve MDN [Learn how to contribute](https://developer.mozilla.org/en-US/docs/MDN/Community/Getting_started) This page was last modified on Nov 25, 2025 by [MDN contributors](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList/contributors.txt). [View this page on GitHub](https://github.com/mdn/content/blob/main/files/en-us/web/api/element/classlist/index.md?plain=1 "Folder: en-us/web/api/element/classlist (Opens in a new tab)") • [Report a problem with this content](https://github.com/mdn/content/issues/new?template=page-report.yml&mdn-url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FAPI%2FElement%2FclassList&metadata=%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EPage+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fapi%2Felement%2Fclasslist%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FAPI%2FElement%2FclassList%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fapi%2Felement%2Fclasslist%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2Fc053b4b3bb0f34736e9f4402d4254830670af723%0A*+Document+last+modified%3A+2025-11-25T17%3A51%3A17.000Z%0A%0A%3C%2Fdetails%3E "This will take you to GitHub to file a new issue.") 1. [Document Object Model (DOM)](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) 2. [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element) 3. Instance properties 1. [`ariaActiveDescendantElement`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaActiveDescendantElement) 2. [`ariaAtomic`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaAtomic) 3. [`ariaAutoComplete`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaAutoComplete) 4. [`ariaBrailleLabel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaBrailleLabel) 5. [`ariaBrailleRoleDescription`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaBrailleRoleDescription) 6. [`ariaBusy`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaBusy) 7. [`ariaChecked`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaChecked) 8. [`ariaColCount`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaColCount) 9. [`ariaColIndex`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaColIndex) 10. [`ariaColIndexText`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaColIndexText) 11. [`ariaColSpan`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaColSpan) 12. [`ariaControlsElements`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaControlsElements) 13. [`ariaCurrent`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaCurrent) 14. [`ariaDescribedByElements`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaDescribedByElements) 15. [`ariaDescription`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaDescription) 16. [`ariaDetailsElements`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaDetailsElements) 17. [`ariaDisabled`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaDisabled) 18. [`ariaErrorMessageElements`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaErrorMessageElements) 19. [`ariaExpanded`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaExpanded) 20. [`ariaFlowToElements`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaFlowToElements) 21. [`ariaHasPopup`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaHasPopup) 22. [`ariaHidden`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaHidden) 23. [`ariaInvalid`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaInvalid) 24. [`ariaKeyShortcuts`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaKeyShortcuts) 25. [`ariaLabel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaLabel) 26. [`ariaLabelledByElements`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaLabelledByElements) 27. [`ariaLevel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaLevel) 28. [`ariaLive`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaLive) 29. [`ariaModal`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaModal) 30. [`ariaMultiLine`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaMultiLine) 31. [`ariaMultiSelectable`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaMultiSelectable) 32. [`ariaOrientation`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaOrientation) 33. [`ariaOwnsElements`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaOwnsElements) 34. [`ariaPlaceholder`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaPlaceholder) 35. [`ariaPosInSet`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaPosInSet) 36. [`ariaPressed`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaPressed) 37. [`ariaReadOnly`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaReadOnly) 38. [`ariaRelevant`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaRelevant) Non-standard 39. [`ariaRequired`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaRequired) 40. [`ariaRoleDescription`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaRoleDescription) 41. [`ariaRowCount`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaRowCount) 42. [`ariaRowIndex`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaRowIndex) 43. [`ariaRowIndexText`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaRowIndexText) 44. [`ariaRowSpan`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaRowSpan) 45. [`ariaSelected`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaSelected) 46. [`ariaSetSize`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaSetSize) 47. [`ariaSort`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaSort) 48. [`ariaValueMax`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaValueMax) 49. [`ariaValueMin`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaValueMin) 50. [`ariaValueNow`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaValueNow) 51. [`ariaValueText`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaValueText) 52. [`assignedSlot`](https://developer.mozilla.org/en-US/docs/Web/API/Element/assignedSlot) 53. [`attributes`](https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes) 54. [`childElementCount`](https://developer.mozilla.org/en-US/docs/Web/API/Element/childElementCount) 55. [`children`](https://developer.mozilla.org/en-US/docs/Web/API/Element/children) 56. *[`classList`](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList)* 57. [`className`](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) 58. [`clientHeight`](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight) 59. [`clientLeft`](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientLeft) 60. [`clientTop`](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientTop) 61. [`clientWidth`](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth) 62. [`currentCSSZoom`](https://developer.mozilla.org/en-US/docs/Web/API/Element/currentCSSZoom) 63. [`customElementRegistry`](https://developer.mozilla.org/en-US/docs/Web/API/Element/customElementRegistry) 64. [`elementTiming`](https://developer.mozilla.org/en-US/docs/Web/API/Element/elementTiming) Experimental 65. [`firstElementChild`](https://developer.mozilla.org/en-US/docs/Web/API/Element/firstElementChild) 66. [`id`](https://developer.mozilla.org/en-US/docs/Web/API/Element/id) 67. [`innerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) 68. [`lastElementChild`](https://developer.mozilla.org/en-US/docs/Web/API/Element/lastElementChild) 69. [`localName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/localName) 70. [`namespaceURI`](https://developer.mozilla.org/en-US/docs/Web/API/Element/namespaceURI) 71. [`nextElementSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nextElementSibling) 72. [`outerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML) 73. [`part`](https://developer.mozilla.org/en-US/docs/Web/API/Element/part) 74. [`prefix`](https://developer.mozilla.org/en-US/docs/Web/API/Element/prefix) 75. [`previousElementSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Element/previousElementSibling) 76. [`role`](https://developer.mozilla.org/en-US/docs/Web/API/Element/role) 77. [`scrollHeight`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight) 78. [`scrollLeft`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft) 79. [`scrollLeftMax`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeftMax) Non-standard 80. [`scrollTop`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop) 81. [`scrollTopMax`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTopMax) Non-standard 82. [`scrollWidth`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth) 83. [`shadowRoot`](https://developer.mozilla.org/en-US/docs/Web/API/Element/shadowRoot) 84. [`slot`](https://developer.mozilla.org/en-US/docs/Web/API/Element/slot) 85. [`tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName) 4. Instance methods 1. [`after()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/after) 2. [`animate()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animate) 3. [`append()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/append) 4. [`ariaNotify()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaNotify) 5. [`attachShadow()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow) 6. [`before()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/before) 7. [`checkVisibility()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility) 8. [`closest()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest) 9. [`computedStyleMap()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/computedStyleMap) 10. [`getAnimations()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations) 11. [`getAttribute()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute) 12. [`getAttributeNames()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames) 13. [`getAttributeNode()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNode) 14. [`getAttributeNodeNS()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNodeNS) 15. [`getAttributeNS()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNS) 16. [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect) 17. [`getClientRects()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getClientRects) 18. [`getElementsByClassName()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName) 19. [`getElementsByTagName()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName) 20. [`getElementsByTagNameNS()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagNameNS) 21. [`getHTML()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getHTML) 22. [`hasAttribute()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute) 23. [`hasAttributeNS()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributeNS) 24. [`hasAttributes()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes) 25. [`hasPointerCapture()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture) 26. [`insertAdjacentElement()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement) 27. [`insertAdjacentHTML()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML) 28. [`insertAdjacentText()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentText) 29. [`matches()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches) 30. [`moveBefore()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/moveBefore) 31. [`prepend()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend) 32. [`querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector) 33. [`querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll) 34. [`releasePointerCapture()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/releasePointerCapture) 35. [`remove()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) 36. [`removeAttribute()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute) 37. [`removeAttributeNode()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNode) 38. [`removeAttributeNS()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNS) 39. [`replaceChildren()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren) 40. [`replaceWith()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith) 41. [`requestFullscreen()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen) 42. [`requestPointerLock()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestPointerLock) 43. [`scroll()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scroll) 44. [`scrollBy()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollBy) 45. [`scrollIntoView()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) 46. [`scrollIntoViewIfNeeded()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded) Non-standard 47. [`scrollTo()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo) 48. [`setAttribute()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute) 49. [`setAttributeNode()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNode) 50. [`setAttributeNodeNS()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNodeNS) 51. [`setAttributeNS()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNS) 52. [`setCapture()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setCapture) Non-standard Deprecated 53. [`setHTML()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setHTML) 54. [`setHTMLUnsafe()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setHTMLUnsafe) 55. [`setPointerCapture()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture) 56. [`toggleAttribute()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute) 5. Events 1. [`afterscriptexecute`](https://developer.mozilla.org/en-US/docs/Web/API/Element/afterscriptexecute_event) Non-standard Deprecated 2. [`animationcancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event) 3. [`animationend`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event) 4. [`animationiteration`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationiteration_event) 5. [`animationstart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationstart_event) 6. [`auxclick`](https://developer.mozilla.org/en-US/docs/Web/API/Element/auxclick_event) 7. [`beforeinput`](https://developer.mozilla.org/en-US/docs/Web/API/Element/beforeinput_event) 8. [`beforematch`](https://developer.mozilla.org/en-US/docs/Web/API/Element/beforematch_event) 9. [`beforescriptexecute`](https://developer.mozilla.org/en-US/docs/Web/API/Element/beforescriptexecute_event) Non-standard Deprecated 10. [`beforexrselect`](https://developer.mozilla.org/en-US/docs/Web/API/Element/beforexrselect_event) Experimental 11. [`blur`](https://developer.mozilla.org/en-US/docs/Web/API/Element/blur_event) 12. [`click`](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event) 13. [`compositionend`](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionend_event) 14. [`compositionstart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event) 15. [`compositionupdate`](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event) 16. [`contentvisibilityautostatechange`](https://developer.mozilla.org/en-US/docs/Web/API/Element/contentvisibilityautostatechange_event) 17. [`contextmenu`](https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event) 18. [`copy`](https://developer.mozilla.org/en-US/docs/Web/API/Element/copy_event) 19. [`cut`](https://developer.mozilla.org/en-US/docs/Web/API/Element/cut_event) 20. [`dblclick`](https://developer.mozilla.org/en-US/docs/Web/API/Element/dblclick_event) 21. [`DOMActivate`](https://developer.mozilla.org/en-US/docs/Web/API/Element/DOMActivate_event) Deprecated 22. [`DOMMouseScroll`](https://developer.mozilla.org/en-US/docs/Web/API/Element/DOMMouseScroll_event) Non-standard Deprecated 23. [`focus`](https://developer.mozilla.org/en-US/docs/Web/API/Element/focus_event) 24. [`focusin`](https://developer.mozilla.org/en-US/docs/Web/API/Element/focusin_event) 25. [`focusout`](https://developer.mozilla.org/en-US/docs/Web/API/Element/focusout_event) 26. [`fullscreenchange`](https://developer.mozilla.org/en-US/docs/Web/API/Element/fullscreenchange_event) 27. [`fullscreenerror`](https://developer.mozilla.org/en-US/docs/Web/API/Element/fullscreenerror_event) 28. [`gesturechange`](https://developer.mozilla.org/en-US/docs/Web/API/Element/gesturechange_event) Non-standard 29. [`gestureend`](https://developer.mozilla.org/en-US/docs/Web/API/Element/gestureend_event) Non-standard 30. [`gesturestart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/gesturestart_event) Non-standard 31. [`gotpointercapture`](https://developer.mozilla.org/en-US/docs/Web/API/Element/gotpointercapture_event) 32. [`input`](https://developer.mozilla.org/en-US/docs/Web/API/Element/input_event) 33. [`keydown`](https://developer.mozilla.org/en-US/docs/Web/API/Element/keydown_event) 34. [`keypress`](https://developer.mozilla.org/en-US/docs/Web/API/Element/keypress_event) Deprecated 35. [`keyup`](https://developer.mozilla.org/en-US/docs/Web/API/Element/keyup_event) 36. [`lostpointercapture`](https://developer.mozilla.org/en-US/docs/Web/API/Element/lostpointercapture_event) 37. [`mousedown`](https://developer.mozilla.org/en-US/docs/Web/API/Element/mousedown_event) 38. [`mouseenter`](https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseenter_event) 39. [`mouseleave`](https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseleave_event) 40. [`mousemove`](https://developer.mozilla.org/en-US/docs/Web/API/Element/mousemove_event) 41. [`mouseout`](https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseout_event) 42. [`mouseover`](https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseover_event) 43. [`mouseup`](https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseup_event) 44. [`mousewheel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/mousewheel_event) Non-standard Deprecated 45. [`MozMousePixelScroll`](https://developer.mozilla.org/en-US/docs/Web/API/Element/MozMousePixelScroll_event) Non-standard Deprecated 46. [`paste`](https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event) 47. [`pointercancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointercancel_event) 48. [`pointerdown`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerdown_event) 49. [`pointerenter`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerenter_event) 50. [`pointerleave`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerleave_event) 51. [`pointermove`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointermove_event) 52. [`pointerout`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerout_event) 53. [`pointerover`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerover_event) 54. [`pointerrawupdate`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerrawupdate_event) 55. [`pointerup`](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerup_event) 56. [`scroll`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scroll_event) 57. [`scrollend`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollend_event) 58. [`scrollsnapchange`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollsnapchange_event) Experimental 59. [`scrollsnapchanging`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollsnapchanging_event) Experimental 60. [`securitypolicyviolation`](https://developer.mozilla.org/en-US/docs/Web/API/Element/securitypolicyviolation_event) 61. [`touchcancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/touchcancel_event) 62. [`touchend`](https://developer.mozilla.org/en-US/docs/Web/API/Element/touchend_event) 63. [`touchmove`](https://developer.mozilla.org/en-US/docs/Web/API/Element/touchmove_event) 64. [`touchstart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/touchstart_event) 65. [`transitioncancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitioncancel_event) 66. [`transitionend`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionend_event) 67. [`transitionrun`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionrun_event) 68. [`transitionstart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionstart_event) 69. [`webkitmouseforcechanged`](https://developer.mozilla.org/en-US/docs/Web/API/Element/webkitmouseforcechanged_event) Non-standard 70. [`webkitmouseforcedown`](https://developer.mozilla.org/en-US/docs/Web/API/Element/webkitmouseforcedown_event) Non-standard 71. [`webkitmouseforceup`](https://developer.mozilla.org/en-US/docs/Web/API/Element/webkitmouseforceup_event) Non-standard 72. [`webkitmouseforcewillbegin`](https://developer.mozilla.org/en-US/docs/Web/API/Element/webkitmouseforcewillbegin_event) Non-standard 73. [`wheel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event) 6. Inheritance 1. [`Node`](https://developer.mozilla.org/en-US/docs/Web/API/Node) 2. [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) 7. Related pages for DOM 1. [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) 2. [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) 3. [`AbstractRange`](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange) 4. [`Attr`](https://developer.mozilla.org/en-US/docs/Web/API/Attr) 5. [`CDATASection`](https://developer.mozilla.org/en-US/docs/Web/API/CDATASection) 6. [`CharacterData`](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData) 7. [`Comment`](https://developer.mozilla.org/en-US/docs/Web/API/Comment) 8. [`CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent) 9. [`DOMError`](https://developer.mozilla.org/en-US/docs/Web/API/DOMError) Deprecated 10. [`DOMException`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException) 11. [`DOMImplementation`](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation) 12. [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser) 13. [`DOMTokenList`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList) 14. [`Document`](https://developer.mozilla.org/en-US/docs/Web/API/Document) 15. [`DocumentFragment`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment) 16. [`DocumentType`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType) 17. [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event) 18. [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) 19. [`HTMLCollection`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection) 20. [`MutationObserver`](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) 21. [`MutationRecord`](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord) 22. [`NamedNodeMap`](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap) 23. [`Node`](https://developer.mozilla.org/en-US/docs/Web/API/Node) 24. [`NodeIterator`](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator) 25. [`NodeList`](https://developer.mozilla.org/en-US/docs/Web/API/NodeList) 26. [`ProcessingInstruction`](https://developer.mozilla.org/en-US/docs/Web/API/ProcessingInstruction) 27. [`QuotaExceededError`](https://developer.mozilla.org/en-US/docs/Web/API/QuotaExceededError) Experimental 28. [`Range`](https://developer.mozilla.org/en-US/docs/Web/API/Range) 29. [`ShadowRoot`](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot) 30. [`StaticRange`](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange) 31. [`Text`](https://developer.mozilla.org/en-US/docs/Web/API/Text) 32. [`TreeWalker`](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker) 33. [`XMLDocument`](https://developer.mozilla.org/en-US/docs/Web/API/XMLDocument) 34. [`XPathEvaluator`](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator) 35. [`XPathExpression`](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression) 36. [`XPathResult`](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult) 37. [`XSLTProcessor`](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor) 8. Guides 1. [Anatomy of the DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Anatomy_of_the_DOM) 2. [Attribute reflection](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Reflected_attributes) 3. [Selection and traversal on the DOM tree](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree) 4. [Building and updating the DOM tree](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Building_and_updating_the_DOM_tree) 5. [Working with events](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Events) Your blueprint for a better internet. MDN - [About](https://developer.mozilla.org/en-US/about) - [Blog](https://developer.mozilla.org/en-US/blog/) - [Mozilla careers](https://www.mozilla.org/en-US/careers/listings/) - [Advertise with us](https://developer.mozilla.org/en-US/advertising) - [MDN Plus](https://developer.mozilla.org/en-US/plus) - [Product help](https://support.mozilla.org/products/mdn-plus) Contribute - [MDN Community](https://developer.mozilla.org/en-US/community) - [Community resources](https://developer.mozilla.org/en-US/docs/MDN/Community) - [Writing guidelines](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines) - [MDN Discord](https://developer.mozilla.org/discord) - [MDN on GitHub](https://github.com/mdn) Developers - [Web technologies](https://developer.mozilla.org/en-US/docs/Web) - [Learn web development](https://developer.mozilla.org/en-US/docs/Learn_web_development) - [Guides](https://developer.mozilla.org/en-US/docs/MDN/Guides) - [Tutorials](https://developer.mozilla.org/en-US/docs/MDN/Tutorials) - [Glossary](https://developer.mozilla.org/en-US/docs/Glossary) - [Hacks blog](https://hacks.mozilla.org/) - [Website Privacy Notice](https://www.mozilla.org/privacy/websites/) - [Telemetry Settings](https://www.mozilla.org/en-US/privacy/websites/data-preferences/) - [Legal](https://www.mozilla.org/about/legal/terms/mozilla) - [Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/) Visit [Mozilla Corporation’s](https://www.mozilla.org/) not-for-profit parent, the [Mozilla Foundation](https://foundation.mozilla.org/). Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under [a Creative Commons license](https://developer.mozilla.org/docs/MDN/Writing_guidelines/Attrib_copyright_license).
Readable Markdown
## [Value](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#value) A [`DOMTokenList`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList) object representing the contents of the element's `class` attribute. If the `class` attribute is not set or empty, it returns an empty `DOMTokenList`, i.e., a `DOMTokenList` with the `length` property equal to `0`. Although the `classList` property itself is read-only in the sense that you can't replace the `DOMTokenList` object, you can still assign to the `classList` property directly, which is equivalent to assigning to its [`value`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/value "value") property. You can also modify the `DOMTokenList` object using the [`add()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add "add()"), [`remove()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove "remove()"), [`replace()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/replace "replace()"), and [`toggle()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle "toggle()") methods. ## [Examples](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#examples) js ``` const div = document.createElement("div"); div.classList = "foo"; // forwarded to classList.value // our starting state: <div class="foo"></div> console.log(div.outerHTML); // use the classList API to remove and add classes div.classList.remove("foo"); div.classList.add("another-class"); // <div class="another-class"></div> console.log(div.outerHTML); // if visible is set remove it, otherwise add it div.classList.toggle("visible"); // add/remove visible, depending on test conditional, i less than 10 div.classList.toggle("visible", i < 10); // false console.log(div.classList.contains("foo")); // add or remove multiple classes div.classList.add("foo", "bar", "baz"); div.classList.remove("foo", "bar", "baz"); // add or remove multiple classes using spread syntax const cls = ["foo", "bar"]; div.classList.add(...cls); div.classList.remove(...cls); // replace class "foo" with class "bar" div.classList.replace("foo", "bar"); ``` ## [Specifications](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#specifications) | Specification | |---| | [DOM \# ref-for-dom-element-classlistâ‘ ](https://dom.spec.whatwg.org/#ref-for-dom-element-classlist%E2%91%A0) | ## [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#browser_compatibility) ## [See also](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#see_also) - [`Element.className`](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) - [`DOMTokenList`](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList)
Shard53 (laksa)
Root Hash7082249407640205653
Unparsed URLorg,mozilla!developer,/en-US/docs/Web/API/Element/classList s443