Re: [jQuery] get the element that called the function...
lots of easy ways to do this depending on your markup.
assuming that the 2 links share the a parent container as in:
<div class="vendors">
<a>Other Link</a>
<a>good Link</a>
</div>
then using .siblings() would be easy method
$('.vendors a').click(function(){
//ajax
$(this).siblings('a').hide();
return false;
});
without an example of markup hard to give a definitive answer
John Corry wrote:
> I am a pretty experienced PHP programmer with a little bit of
> javascript experience and am LOVING jQuery.
>
> I'm working on a tool that will allow users of my app to merge vendors
> on their vendor edit page.
>
> Basically, if vendor names are similar, I display both vendors with a
> link for each. Depending on which link you click, you can keep one
> vendor and discard the other.
>
> This is all done by a function that:
> - presents a confirmation to the user
> - calls $.ajax to do the data processing
>
> I have it all working (sorry, it's not a public site I can show) the
> way I want except for one detail.
>
> I want the ajax method to .hide() the link that WASN'T clicked on success.
>
> How do I know, inside the scope of the function, which element's
> onclick event triggered the function.
>
> If I knew that, it would be easy to hide the other one...
>
> --
> John Corry
> PHP developer - 3by400, Inc
> http://www.3by400.com
>
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home