Ralph D
Ralph D

Reputation: 103

document.getElements() support

How well supported is the document.getElements() function. Additionally, is there a javascript reference page that has detailed browser support information somewhere. I usually use the mozilla docs, but I was wondering if there is something better.

I actually can't find any documentation on document.getElements() but when I do things like:

document.getElements("div a");

It works great in chrome, ff, safari, ie8 and ie6-9 via IETester. I think IETester may use the same javascript engine for all browsers though (not sure about that).

Upvotes: 5

Views: 12836

Answers (3)

Eugen Konkov
Eugen Konkov

Reputation: 25223

Probably you are looking for querySelecterAll function:

elementList = parentNode.querySelectorAll(selectors);

This is most handy and much usable function.

To check how your requested feature is supported among browsers you can use "Can I Use" site:

https://caniuse.com/#search=querySelectorAll

On this site you can check not only functions but HTML attributes and CSS capabilities too

Upvotes: 1

Zevan
Zevan

Reputation: 10235

There is no such thing as document.getElements... I'll bet your coding in Jsfiddle and don't realize that the mootools lib is included ;)

Have a look: http://jsfiddle.net/Zevan/pRKzy/

Upvotes: 8

Nick Craver
Nick Craver

Reputation: 630589

quirksmode.org is a pretty good resource for things like this (though not fully updated on IE9, as it's a moving target at the moment).

Note: they don't have an entry for document.getElements() specifically (are you sure you're getting this name right?), but in general it's a pretty complete reference, here's an example - check out .querySelectorAll() (which does what you describe...).

Upvotes: 0

Related Questions