I think you've misunderstood my question.

I have two values that are only found in a loop in the HTML. They need
to be passed to the single function in the document.ready().

I can't set them in the JavaScript. I have to "find" them somehow in
the HTML. Whether I find them as hidden inputs or something, or as
tags to the anchor, or as params passed in somehow. I'm not sure
what's best.

Basically, there could be 10 "edit-link" classes, but when a specific
"edit-link" anchor is clicked, I need to perform an Ajax function that
needs two params passed into it that are unique to that "edit-link".

On Apr 16, 4:53 pm, Joseph Le Brech <[email protected]> wrote:
> i think itll be covered in this.
>
> http://stackoverflow.com/questions/224820/how-do-you-pass-arguments-t...
>
>
>
> > Date: Thu, 16 Apr 2009 14:46:41 -0700
> > Subject: [jQuery] passing more than 1 param via click()?
> > From: [email protected]
> > To: [email protected]
>
> > Hey all,
>
> > Not really sure how to ask this, so I'm sorry if my title is mis-
> > leading. It is also why I wasn't able to find much searching, so I'm
> > sorry if it's answered already.
>
> > Basically, the code I inherited was this:
>
> > <a
> >      href="#drop"
> >      class="edit-link"
> >      onclick="
> >           removeDept('<c:out value="${key}" />','<c:out value="$
> > {name}" />');
> >           return false;"
> > >Remove Department</a>
>
> > And that is in an iteration, so the two values passed to the
> > "removeDept" function are always dynamic.
>
> > I'm trying to handle this in the document.ready(). Normally, I throw
> > the would-be dynamic param passed as a rel tag on an anchor, and
> > that's how I retrieve things when I clean up code like this.
>
> > However, I'm scratching my head for the *best* way to handle this with
> > the two params now... How do you guys recommend I handle something
> > like that?
>
> > $(document).ready(function() {
> >    $(".edit-link").click(function(){
> >                removeDept($(this).attr("rel"),$(this).attr("rel"));
> >                return false;
> >    });
> > });
>
> > Obviously I can't have two rel attributes :)
>
> > Thanks in advance.
>
> _________________________________________________________________
> View your Twitter and Flickr updates from one place – Learn 
> more!http://clk.atdmt.com/UKM/go/137984870/direct/01/

Reply via email to