querySelectorAll method is not supported with IE11 in standards mode

Viewed 8996

I'm having an issue with IE11. The document.querySelectorAll is causing some issues.

Whenever I use it via the console like so:

document.querySelectorAll('.test_class');

I get the following error:

Object doesn't support property or method 'querySelector'

I'm not in quirks mode as I found that this was an issue for others that had this problem. I have also added the <!DOCTYPE html> to my Web page.

What am I missing?

2 Answers

Here is how you can do it:

let classes = document.querySelectorAll('.test_class') Array.prototype.forEach.call(classes, element => { console.log("class",element) })

Related