views:

72

answers:

1

Why doesn't this jquery work, according to firebug none of the javascript lines are being reached:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
    <head>
        <script type="text/javascript"
        src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
        <script type="text/javascript">
            google.load("jquery", "1.4.0");
            google.setOnLoadCallback(function() {
              $("p").css("background-color","red");
            } 
        </script>
    </head>
<body>
  <p>test</p>
</body>
</html>
+4  A: 

You have a missing right parenthesis ):

google.load("jquery", "1.4.0");
google.setOnLoadCallback(function() {
  $("p").css("background-color","red");
}); // <--- Here
CMS
+1 Looked at the wrong docs to start and thought the API key was required as well. Removed my answer since your was all that was needed :)
Doug Neiner
Thanks a lot Doug!
CMS