For what it's worth, I copied and pasted your HTML code and tested it on my
computer and it worked.

There were two changes I had to make.

1.  There are some odd line-breaks in your html below.  Maybe they were
added by your e-mail client, but I had to make 

<script type="text/javascript">

into one line, </head> and </body> as well.

I also removed the <pre> tags, though again, perhaps those were added by
your mail client.

Lastly, the path to jquery.js was different in my test environment.

Assuming the line breaks aren't the cause, ensure you have a correct path to
your jquery script file.  Because basically, the code you wrote worked fine
on my machine.

JK

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of kenny
Sent: Monday, March 03, 2008 12:14 PM
To: jQuery (English)
Subject: [jQuery] Can't get started on Getting Started :)


Disclaimer: Complete jQuery/JavaScript noob here, but heavily
experienced developer overall. (And I have been googling around
finding similar questions, but nothing from those exchanges can get
this basic hello-world example working.)

Platform: FireFox 2.0.0.12 on Windows XP

Here is what I had after the first suggested enhancement, namely
adding an alert on a click:
<pre>
 
<html>
 
<head>
   <script type="text/javascript" src="jquery.js"></script>
   <script type="text/
javascript">
      $(document).ready(function() {
         $("a").click(function() {
            alert("Hello world!");
         });
      });
   </script>
  </
head>
 
<body>
   <--- we will add our HTML content here -->
  </
body>
 </html>
</pre>

My first question is about the comment in the instructions that says:
"This should show the alert as soon as you click on the link.". I do
not see any link. No big deal, I added one.

My next question is simply that once I do add a link:

<pre>
 
<html>
 
<head>
   <script type="text/javascript" src="jquery.js"></script>
   <script type="text/
javascript">
     $(document).ready(function() {
                        $("a").click(function() {
                           alert("Hello world!");
                           });
                        });
   </script>
  </
head>
 
<body>
   <--- we will add our HTML content here -->
   <a href="">nowhere</a>
  </
body>
 </html>
</pre>

... I still do not get an alert.

I do get an alert if I add the suggested alternative:

<pre>
   <a href="" onclick="alert('Hello world')">Link</a>
</pre>

...and then click on the link, so that much is working.

I ended up on this tutorial after experiencing the same thing on the
"How jQuery Works" tutorial, by the way.

Any help appreciated.

Reply via email to