jQuery not working with IE 11

前端 未结 6 845
离开以前
离开以前 2020-12-08 18:44

Object doesn\'t support property or method \'addEventListener\'

\'jQuery\' is undefined 

I\'m using IE 11,

/jquer

相关标签:
6条回答
  • 2020-12-08 19:21

    As Arnaud suggested in a comment to the original post, you should put this in your html header:

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    

    I don't want any cred for this. I just want to make it more visible for anyone else that come here.

    0 讨论(0)
  • 2020-12-08 19:21

    For me the issue turned out to be I was using es6's right arrow functions => as opposed to function ().

    Replacing => with function () resolved for me.

    I had assumed it was a jQuery issue.

    0 讨论(0)
  • 2020-12-08 19:26

    Adding the "x_ua_compatible" tag to the page didn't work for me. Instead I added it as an HTTP Respone Header via IIS and that worked fine.

    In IIS Manager select the site then open HTTP Response Headers and click Add:

    The site didn't need restarting, but I did need to Ctrl+F5 to force the page to reload.

    0 讨论(0)
  • 2020-12-08 19:28

    Place this meta tag after head tag

    <meta http-equiv="x-ua-compatible" content="IE=edge">
    
    0 讨论(0)
  • 2020-12-08 19:30

    Thanks @Arnaud & @Conny for highlighting this answer. This really helped me. I would like to add one more thing here is, adding this line <meta http-equiv="x-ua-compatible" content="IE=edge"> just after the title in tag prior to all meta tags is must for to work as it overrides the compatibility mode of IE.

    0 讨论(0)
  • 2020-12-08 19:31

    The problem was caused because the page was an intranet site, & IE had compatibility mode set to default for this. IE11 does support addEventListener()

    0 讨论(0)
提交回复
热议问题