On Sep 27, 2007, at 11:44 AM, cmbtrx wrote:

OK, forgive my tone here...I'm actually quite flabbergasted.

I ***FINALLY*** get around to trying out jquery.

Oh, I'm sure that quite obviously I'm doing something wrong, because
after following the first few paragraphs of the "How JQuery Works"
section (clicking a link launches an alert box...uh ok, no fine) it
does absolutely nothing.

Please go back to that page and keep reading. That link wasn't intended to be a demo. It was supposed to take you to the events page where you can read about the click method.

Two paragraphs down, you'll see this:

For click and most other events, you can prevent the default behaviour - here, following the link to jquery.com - by returning false from the event handler:

 $("a").click(function(){
   alert("Thanks for visiting!");
   return false;
 });

You can either paste that into Firebug and then try clicking on a link or put it in your own script. If you put it in your own script, make sure, as that page instructs, that you put it "In the ready function (from the example above)."

So, then it would look like this:

$(document).ready(function() {
  $("a").click(function(){
    alert("Thanks for visiting!");
    return false;
  });
});

Or course, you need to reference the jquery.js file first. And you should put this either within a <script> tag in the <head> or in a separate file and reference that file (after jquery.js).

So far the javascript skills required for testing this are sub-fetal

Huh?

If you're still having problems, let us know. We're generally pretty friendly around here.


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




Reply via email to