codeNinja
codeNinja

Reputation: 1462

jquery script not running

I have two pages. First one is index.html which has a script to load a second page. The second page has a jquery script that is supposed to run and show a alert.

In the code that is shown below i have removed all extra stuff to simplify my question.

Code for index.html:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <title>Testing</title>
    <link type="text/css" rel="stylesheet" href="./review/includes/look.css" />
  </head>
  <body class="review offline" tabindex="0">
    <div id="sidepanel" class="hidden">
      <div class="section" >
        <div id="navigation" class="rounded-border">
          <ul id="navigationtree">
            <li class="leaf last" title="Home">
              <ins class="icon">&nbsp;</ins><a href="screens/alertPage" tabindex="-1"></a>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <div id="jim-mainWindow">
        <div id="jim-body" class="full web" >
            <div id="simulation" class="firer"></div>

        </div>
    </div>

    <script type="text/javascript" src="./review/includes/j.js"></script>
    <script type="text/javascript">jQuery(document).ready(function(){jimMain.init("screens/alertPage");});</script>
  </body>
</html>

The code for the second page is:

<html>
  <body>

    <script src="jquery-1.10.1.js"></script>
    <script>
        jQuery(document).ready(function(){
            alert("hi there");
            }
        }
    </script>
  </body>
</html>

1) I have made sure the jquery-1.10.1.js page is in the same directory as alertPage.html 2) I have validated that alertPage.html is actually being loaded by index.html by adding from UI to alertPage and seeing it being rendered.

What am i missing here?

Upvotes: 0

Views: 108

Answers (2)

heymega
heymega

Reputation: 9391

Load your custom js after you have loaded in jQuery

<script src="jquery-1.10.1.js"></script>
<script type="text/javascript" src="./review/includes/j.js"></script>
<script>
    jQuery(document).ready(function(){
        alert("hi there");
    });
</script>

Upvotes: 0

tymeJV
tymeJV

Reputation: 104775

Missing ), extra }

jQuery(document).ready(function(){
    alert("hi there");
    //Remove the }
}); //<---Add the );

Upvotes: 4

Related Questions