简体   繁体   中英

$(document).ready function will not fire

I'm attempting to create a very simple HTML document with an even less complex $(document).ready() function. However.... nothing in the function will fire. I've set alerts and breakpoints (in Chrome's debugger) and nothing works. Below is the markup.

<!DOCTYPE HTML>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js" />
<script>
    alert('outside');
    $(document).ready(function() {
        alert('here');
    });
</script>
</head>

Neither alerts work. Not sure what I'm doing wrong here.

<script src="http://code.jquery.com/jquery-1.11.0.min.js" />改为

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

<script>
alert('outside');
$(document).ready(function() {
    alert('here');
});
</script>

you forgot to close the arches. and the closing tag of script.

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