1
votes

I have a standard piece of HTML but cannot get jQuery to work on IE. I tried IE10 and IE11, as well as IE8 and 9 emulated in IE10.

I even tried using the code from HTML5Boilerplate. I am testing for jquery and is not loaded.

Code works in all other browsers. I am running this on my local, not on a server.

<!DOCTYPE html>
<html>

<head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>

<body>

    <script type="text/javascript">
        if (window.jQuery) {
            // jQuery is available.
        } else {
            console.log("-- no jquery --");
        }
    </script>

</body>

</html>

Why can't I get this to work in IE ?

I get -- no jquery -- SCRIPT5007: The value of the property '$' is null or undefined, not a Function object in the console.

Also, if I type jQuery().jquery in the console, I get undefined.

Network tab is not displaying any errors.

1
Are you sure that "js/jquery-1.11.1.js" exists? And if yes, have you tried on other browsers?Dim13i
So what happen??? Error in console? Message in console? Could it be cache issue? Network tab? Javascrpit disabled? Etc... You have to debug it on your sideA. Wolff
@LarryLane, his script tags look fine to me.Sparky
If you're testing this locally and not on a server, change src="//ajax.googleapis.com to src="http://ajax.googleapis.comj08691
What @j08691 said. Page needs to be online in order for you to leave off the http: scheme. Pages on your local hard drive will not work without a http: or https: scheme.Sparky

1 Answers

3
votes

Quote OP:

I am running this on my local, not on a server

Then you need to specify a scheme, otherwise the browser may assume that src="//domain.com/script.js" is src="file://domain.com/script.js", which will break since you're not hosting this resource locally.

References: