简体   繁体   中英

JQuery Script not being read in by HTML

My JQuery code is not working. I tried functions such as "mouseenter" and that didn't work, so I simply tried this and the alert does not show up. Is it a problem with the syntax or possibly something I am missing?

<script type="text/javascript" src="jquery-2.0.0.min.js"></script>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<script type="text/javascript" src="script.js"></script>

The JS is this:

    $(document).ready(function() {
        alert("JQuery is working! :D");
    });

EDIT:

scr -> src However, this has not solved the problem.

I am using Chrome v. 26 on Mac OSX 10.7.5

This is the console error: Uncaught SyntaxError: Unexpected token }

The line

<script type="text/javascript" scr="jquery-2.0.0.min.js"></script>

has "src" misspelled.

It should be

<script type="text/javascript" src="jquery-2.0.0.min.js"></script>

As a result, jQuery is not loading.

When diagnosing this type of issue, it is useful to open the JavaScript console. In IE or Chrome, press F12 then select the JavaScript tab. You would probably see an error along the lines of "$ is not defined".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM