Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery 2.0.3 not working with IE

Tags:

jquery

I have the following sample html file:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Example</title>
    <script src="../Scripts/jquery-2.0.3.js"></script>
    <!--<script src="../Scripts/jquery-1.7.js"></script>-->
    <script type="text/javascript">
        $(document).ready(function () {
            $('#mainheader').css("color", "red");
        });
    </script>
</head>
<body>
    <h1 id="mainheader" class="header">Sample 1</h1>
    <h2 class="header info">Sample 2</h2>
    <h3 class="info">Sample 3</h3>
</body>
</html>

When i run the same with jQuery version 2.0.3, it runs into error:

Unhandled exception at line 834, column 4 in /Scripts/jquery-2.0.3.js

0x800a01b6 - Microsoft JScript runtime error: Object doesn't support this property or method

At the line: // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed, false );

But if I run with a lower version of it i.e., 1.7, it works fine...

However the above code works perfectly fine for both versions on Chrome.

Can you please help me out with the differences:

Thanks & Regards.

like image 867
Anil V K Babu Avatar asked Sep 13 '13 06:09

Anil V K Babu


People also ask

Does jQuery 2.0 support IE?

Those improvements come at a price, though: jQuery 2.0 won't support Internet Explorer 6, 7, or 8.

Does jQuery work on IE?

If you need to support older browsers like Internet Explorer 6-8, Opera 12.1x or Safari 5.1+, use jQuery 1.12.

Is jQuery supported by all browsers?

Cross-browser compatibility — jQuery supports older browsers which do not do well with modern tools, frameworks or libraries. jQuery-powered applications work well on all browsers.

What can I use instead of jQuery browser?

Nevertheless, Native javascript is one of the best jQuery alternatives, in fact, It is the framework of JS. Javascript is the best because any browsers ships with javascript and you do not need to install jQuery in your application.


1 Answers

At the moment jQuery 2.x " does not support Internet Explorer 6, 7, or 8"

From http://api.jquery.com/jQuery.browser/:

like image 114
Alessandro Minoccheri Avatar answered Nov 23 '22 23:11

Alessandro Minoccheri