Home Download Buy Blog Forum Support

Why isn't my Jquery working?

Why isn't my Jquery working?

Postby MichaelT on Sat Aug 18, 2012 3:01 pm

UPDATE: ISSUE RESOLVED

I thought I'd post the answer here ( incase anybody is a dumb as me :oops: )

When using HTML 5 Boilerplate some text editors call Javascript differently.

To get it working with ST2 you need to call it by editing this:

Code: Select all
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>


to this

Code: Select all
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script>


within the index.html.

I may be wrong, but this has JavaScript working in my browser – when viewing via a local host.

******

Hello,

I'm really confused.

I'm using HTML5 Boilerplate.

And I'm trying to teach myself a bit of JavaScript (with the help of Jquery).

However, whatever I do doesn't work :( .

Now, I'm trying to view what I've done in my HTML via Google Chrome on a localhost.

When I load it into a browser (localhost) nothing is hidden.

Here's what I'm seeing on my HTML document.


Code: Select all
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title></title>
  <meta name="description" content="">
  <meta name="author" content="">

  <meta name="viewport" content="width=device-width,initial-scale=1">

  <!-- CSS concatenated and minified via ant build script-->
  <link rel="stylesheet" href="css/style.css">
  <!-- end CSS-->

  <script src="js/libs/modernizr-2.0.6.min.js"></script>
 
  <script type="text/javascript">
    $(document).ready(function()
{
  $('p').hide();
  $(a#paragraphAnchor).click(function()
  {
    $('p').show("fast")
  });
});

  </script>
</head>

<body>

 
<a href="#" id="paragraphAnchor">click me</a>
<p>This is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a testThis is  a test</p>


  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  <script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>


  <!-- scripts concatenated and minified via ant build script-->
  <script defer src="js/plugins.js"></script>
  <script defer src="js/script.js"></script>
  <!-- end scripts-->


  <script> // Change UA-XXXXX-X to be your site's ID
    window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
    Modernizr.load({
      load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
    });
  </script>


  <!--[if lt IE 7 ]>
    <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
    <script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
  <![endif]-->
 
</body>
</html>
MichaelT
 
Posts: 6
Joined: Sat Aug 11, 2012 8:09 pm

Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 26 guests