photoboy,

It works because "text" is a function on the jQuery object and so you
need to use the parens to invoke the function.   You could also access
the DOM element directly and get the value like this:

var linkContent = this.nodeValue;

Mike


On 10/21/07, photoboy <[EMAIL PROTECTED]> wrote:
>
> Wow Mike, thanks.
> I'm not sure why that worked, but it definitely did the trick!
> Much appreciated.
>
>
> On Oct 21, 3:01 pm, "Mike Alsup" <[EMAIL PROTECTED]> wrote:
> > var linkContent = $(this).text();
> >
> > $(this) returns a jQuery object, not a DOM element.
> >
> > On 10/21/07, photoboy <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > I'm just starting out with jQuery and am already staring at a wall.
> > > The goal: attach a mouse event to all links in a paragraph with id
> > > 'para' and display the text of the link.
> >
> > > this is what I've come up with, which obviously doesn't work:
> >
> > > $("#para  a").click(function(){
> > >   var linkContent = $(this).text;
> > >   alert (linkContent);
> > > });
> >
> > > the click event works, and an alert pops up, but the content of the
> > > alert is a javascript function, written out in all its glory.
> >
> > > I can't imagine I'm too far off here. Can anyone assist?
>
>

Reply via email to