On 12/03/07, Aaron Heimlich <[EMAIL PROTECTED]> wrote:
> On 3/12/07, Sam Collett <[EMAIL PROTECTED]> wrote:
> > each has a parameter which is the index:
> >
> > $(document).ready( function() {
> > $('#articlesIndex li a').click( function(i) {
> >     alert("You just clicked list item number: " + (i + 1));
> >     return false; // prevents the hyperlink from firing
> > } );
> > } );
> >
>
> Except that it doesn't (to my knowledge) get passed to event handlers. The
> first parameter of an event handler is the event object.
>
>
>
> --
> Aaron Heimlich
> Web Developer
> [EMAIL PROTECTED]
> http://aheimlich.freepgs.com

Should have been:

$(document).ready( function() {
 $('#articlesIndex li a').each( function(i) {
   $(this).click( function() {
      alert("You just clicked list item number: " + (i + 1));
      return false; // prevents the hyperlink from firing
   } );
 } );
} );

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to