getElementsByClassName
getElementsByClassName
This page has been flagged with the following issues:
High-level issues:
W3C Candidate Recommendation
Summary
Use elementOrDocument.querySelectorAll(".class-name.other-class-name") instead. Gets a collection of all descendant elements with given classes.
Method of dom/HTMLElement
Syntax
var elements = element.getElementsByClassName(classNames);
Parameters
classNames
Data-type: String
A space separated list of classes.
Return Value
Returns an object of type Object.
Needs Examples: This section should include examples.
Usage
The use of this property is discouraged. See the Notes section for details.
Notes
The use of this property is discouraged, due to the performance implications (due to the live DOMCollection where any changes to the document must be reflected on the returned object immediately) and complexity (the removal of an element from the document will result in immediate changes to the collection).
A close alternative -
Related specifications
| Specification | Status | Related Changes |
|---|---|---|
| W3C HTML5 | Candidate Recommendation | Section 3.1.1 |
Compatibility
Desktop
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic Support | Supported (when?) | 3 | 9 | 9.5 |
3.1 |
Mobile
| Feature | Android | BlackBerry | Chrome for mobile | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Opera Mini | Safari Mobile |
|---|---|---|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? | ? | ? | ? |
This article contains content originally from external sources.
Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]
This tool helps to make and review comments inline.
How to Use
insert instructions, with images, here