1

Possible Duplicate:
IE9 equivalent of querySelectorAll

I'm trying to get all elements with the classname "video" in some JS running in IE9. I'm using var videopanels = document.querySelectorAll(".video"); which is working great in Chrome.

Unfortunately I'm getting this error when I watch document.querySelectorAll(".video") in the debugger:

document.querySelectorAll(".video")
Object doesn't support property or method 'querySelectorAll'
Error

However, when I watch document in the debugger (it shows up as a DispHTMLDocument) and open up the [Methods] list, I see

querySelectorAll()
querySelectorAll(v)
IHTMLDOMChildrenCollection

What's going on? How come I can see it in the debugger, but not (apparently) actually call or use it?

Community
  • 1
  • 1
Andrew Wyld
  • 7,133
  • 7
  • 54
  • 96

1 Answers1

4

Change your doctype to html5 standards.

<!DOCTYPE html>

Also check IE9 isn't operating in compatibility mode as this may cause it to ignore some methods it supports.

Andrew Wyld
  • 7,133
  • 7
  • 54
  • 96
Robin Jonsson
  • 2,761
  • 3
  • 22
  • 42