javascript - querySelectorAll method is not supported with IE11 in standards mode - Stack Overflow

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

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?

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?

Share Improve this question asked Jul 22, 2017 at 23:44 ObiHillObiHill 11.9k24 gold badges92 silver badges142 bronze badges 1
  • 1 are you in patibility mode? – Daniel A. White Commented Jul 22, 2017 at 23:46
Add a ment  | 

2 Answers 2

Reset to default 2

Here is how you can do it:

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

I just found the answer to this almost as soon as I posted the question:

The issue was to add the following metatag:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

Found this here: http://corpus.hubwiz./2/angularjs/25632927.html

Hope it helps.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745162637a4614459.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信