Yep,

I read
http://docs.jquery.com/Attributes

It did not help.
$(this).attr('href')
is easy to understand.

What I did not understand was that "this" had evaporated.

Once I put "this" in my click() call and then picked it up in tellme
(object), I could see "this" in my debugger
and everything fell into place.

I guess this more of a very general programing idea than an API issue.

If I want "this", I need to carry it with me.

I can't expect it to follow me around like a pet dog.

Actually in Safari it did follow me around.

Not in Firefox though.

-Audrey

On Aug 21, 5:56 pm, Charlie Griefer <charlie.grie...@gmail.com> wrote:
> $(this).attr('href')
>
> http://docs.jquery.com/Attributes
>
> On Fri, Aug 21, 2009 at 3:53 PM, Audrey A Lee 
> <audrey.lee.is...@gmail.com>wrote:
>
>
>
>
>
> > jQuery People,
>
> > Suppose I have this syntax:
>
> > $("a.someLinks").click(function(event){tellme();});
>
> > I want tellme() to handle the value of href of the clicked link.
>
> > What syntax do I put in tellme()?
>
> > I got this far:
>
> > function tellme() {
> >  // does not work: alert($(this)[0].href);
> >  // does not work: alert($(this)[0].getAttribute("href"));
> >  // This only works in Safari: alert($(this)
> > [0].event.currentTarget.href);
> > }
>
> > Here is a bigger question:
> > How would I get this info from the API documentation?
>
> > -Audrey
>
> --
> I have failed as much as I have succeeded. But I love my life. I love my
> wife. And I wish you my kind of success.

Reply via email to