SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery newbie question

    Just got the Jquery Novice to Ninja book and didn't go past exercise 1. I use xampp where I placed my index.html with the following...

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>StarTrackr!</title>

    <link rel="stylesheet" href="../../css/base.css" type="text/css" media="screen" charset="utf-8" />
    <script src="../../lib/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="script.js"></script>
    </head>

    The script.js is..
    $(document).ready(function(){
    alert('Welcome to StarTrackr! Now no longer under police investigation!');
    });

    Placed both the html and js under www and when it ran, the js didn't execute. It pints to the $ of the js script and says "Object expected"

    Any idea what I should do to make it run?

    Much appreciated.

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,940
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    Hi there,

    Welcome to the forums.

    You don't need xampp to run JavaScript (although technically nothing speaks against it).
    xampp is a server stack which is useful for server-side technologies, such as PHP.

    What happens if you just go into the folder for the first exercise (should be 'chapter_02\01_document_ready') and double click on index.html?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •