bhh1988
bhh1988

Reputation: 1290

jquery functions inside of document.ready are not being called

I'm new to jquery, looked at some tutorials, but I can't even get myself started. It looks like the stuff under $(document).ready is never being called. Here's the first few lines of my HTML:

<html>
<head>
<title>foobar</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type=\"text/javascript\"> 
$(document).ready(function(){
   alert("READY!");
   $("*").click( function() {
       alert("CLICKED!");
   });
}); </script>
...(some other scripts)
</head>...

I feel like this is as basic as you can get, but I'm not getting any alerts when I load or click on something in the page. Loading the jquery from an external file doesn't work either. I'm using Firefox 9. I don't know where to go from here, and I can't seem to find anything online that solves my problem. Does anyone have any idea of what might be wrong to cause this? Thanks!

Upvotes: 1

Views: 1540

Answers (2)

thecodeparadox
thecodeparadox

Reputation: 87073

<script type=\"text/javascript\"> should be <script type="text/javascript">. cause browsers have not issue with it.

Upvotes: 1

Dennis
Dennis

Reputation: 32598

Your script type is improperly formatted. You could fix it by removing the backslashes, but since all browsers default to javascript, you can omit it entirely:

<script type=\"text/javascript\">

<script>

Upvotes: 5

Related Questions