>Perhaps then you can extract it as text like I mentioned in my first
post, then store it in a variable?

How do I extract it like text ? Calling the .text() method, as
expected doesn't return what I need - DoSomething(this);

On Sep 15, 3:30 pm, MiKiTiE <mikiji...@googlemail.com> wrote:
> Perhaps then you can extract it as text like I mentioned in my first
> post, then store it in a variable?
>
> As I am not sure what your function does or why it needs to be applied
> this way, I can't solve the problem exactly - but why not just use an
> event instead of an onclick in the element? That is what jQuery is
> there for :-)
>
> On Sep 15, 9:50 am, sirrocco <xavier...@gmail.com> wrote:
>
> > Well .. that's the problem - i tried it like that and it didn't work.
>
> > When setting the attribute back on the link, the this in DoSomething
> > (this); is not the link, but the window.
>
> > On Sep 15, 11:41 am,MiKiTiE<mikiji...@googlemail.com> wrote:
>
> > > Sorry I should have written
>
> > > $('a').attr('onclick',onclick);
>
> > > (setting the attribute value not the inner text!)
>
> > > On Sep 15, 9:09 am, sirrocco <xavier...@gmail.com> wrote:
>
> > > > Let's say you have a :
>
> > > > <a href="#" onclick='DoSomething(this);'>asd</a>
>
> > > > I want to get the onclick text in a variable - something like
>
> > > > var onclick = $('a').attr('onclick');
>
> > > > The problem is that the onclick variable now is a function and if I
> > > > try to execute , this   wil be the document instead of the link .
>
> > > > How can I get only the text, so I can later reattach it to the link ?
>
>

Reply via email to