in that particular bit of code, it's useless (since he did not use
it :) ).

but let me point you to an example where passing the event to the
function is useful, see this tutorial :http://docs.jquery.com/
Tutorials:AJAX_and_Events (down the page)

$(document).ready(function() {
 $('body').click(function(event) {
   if ($(event.target).is('h3')) {
     $(event.target).toggleClass('highlighted');
   }
 });
});


hope this helps,

Alexandre



On 24 jan, 10:44, Pickledegg <[EMAIL PROTECTED]> wrote:
> In one of the tutorials on this page:
>
> http://docs.jquery.com/Tutorials:jQuery_For_Designers
>
> in this bit of code, (on the starred line), the 'event' is passed to
> the function that toggles the .thebody class.
>
> I don't understand what this 'event' is and why is it passed on this
> line and not any of the others..
>
> Can someone possibly explain what its there for please? thanks.
>
> // When the page is ready
>    $(document).ready(function(){
>      $(".article .thebody").hide();
>      $("#container .article ul")
>        .prepend("<li class='readbody'><a href='' title='Read the
> article'>Read Body</a></li>");
>
> ********     $(".actions li.readbody a").click(function(event)
> { *********
>        $(this).parents("ul").prev(".thebody").toggle();
>
>        // Stop the link click from doing its normal thing
>        return false;
>      });
>    });

Reply via email to