Just clearing up what Pierre said: if the argument you passed to alert
() is not a string, it's .toString() method will be called. For
convenience, the toString on an anchor HTMLElement object returns it's
href. Try this:

$('a').get(0).toString();
or
$('a').click(function(){
   alert( this.toString() );
   return false;
});

"this" in your code is still an object, it's just the output of
toString() that is different.

cheers
-- ricardo

On Jun 11, 1:10 am, "bensan...@gmail.com" <bensan...@gmail.com> wrote:
> Hi all,
>
> I'm confused as to why when I have:
>
> $('a').click(function(){
> alert(this);
> return false;
>
> });
>
> the alert displays the URL defined in the href attribute, and not an
> object.
>
> Yet, if i call like say an image, it returns the object.
>
> Thanks
> ben

Reply via email to