classList.js is a cross-browser JavaScript shim that provides the standard element.classList interface where it is missing or incomplete. It lets developers manipulate CSS class names through a token-based API instead of manually editing className strings. The implementation includes methods for adding, removing, checking, toggling, replacing, and retrieving individual class tokens. It also normalizes partial native implementations that accept only one token or lack the forced-state argument for toggle. The script works in nearly all historical browsers except Internet Explorer 7 and earlier. Its small standalone and minified builds make it suitable for legacy sites that need consistent DOM class handling without a framework.

Features

  • CSS class addition and removal
  • Class token presence checks
  • Optional-state class toggling
  • Class token replacement
  • Multiple-token method support
  • Normalization of incomplete native implementations

Project Samples

Project Activity

See All Activity >

Categories

Libraries

Follow classList.js

classList.js Web Site

Other Useful Business Software
$300 Free Credits for Your Google Cloud Projects Icon
$300 Free Credits for Your Google Cloud Projects

Start building on Google Cloud with $300 in free credits. No commitment, no credit card required until you're ready to scale.

Launch your next project with $300 in free Google Cloud credits—no strings attached. Test, build, and deploy without risk. Use your credits across the entire Google Cloud platform to find what works best for your needs. After your credits are used, continue with always-free tier services. Only pay when you're ready to scale. Sign up in minutes and start exploring.
Start Free Trial
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of classList.js!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Libraries

Registered

24 hours ago