getElementsByClassName() method allows you to select HTML elements based on their class name. It returns a live HTMLCollection of found elements.
This will return all elements with the class
You can also use
All modern browsers support
getElementsByClassName(). However, if you're working with IE8 or below, consider using jQuery's
For more details about
getElementsByClassName(), visit MDN web docs.
Join our community of forward-thinkers and innovators. Subscribe to get the latest updates on courses, exclusive insights, and tips from industry experts directly to your inbox.