you can also make custom attributes, they don't have to be called "rel" so you 
can have as many attributes as you want.

> Date: Thu, 16 Apr 2009 15:15:44 -0700
> Subject: [jQuery] Re: passing more than 1 param via click()?
> From: [email protected]
> To: [email protected]
> 
> 
> That's a good point, Josh. I thought of that earlier, but I wanted to
> make sure this was the best way. For only passing two params, that's
> not that bad of an idea, but I was checking to see if there was a best
> practice here, like hopefully passing the params through somehow.
> 
> On Apr 16, 5:04 pm, "Josh Nathanson" <[email protected]> wrote:
> > You could do something like:
> >
> > <a rel="val1_val2"> // use a delimiter that makes sense for your values
> >
> > Then split the rel:
> >
> > var arr = this.rel.split('_'), val1 = arr[0], val2 = arr[1];
> >
> > removeDept( val1, val2 );
> >
> > -- Josh
> >
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]] On
> >
> > Behalf Of kgosser
> > Sent: Thursday, April 16, 2009 2:47 PM
> > To: jQuery (English)
> > Subject: [jQuery] passing more than 1 param via click()?
> >
> > 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.

_________________________________________________________________
Share your photos with Windows Live Photos – Free.
http://clk.atdmt.com/UKM/go/134665338/direct/01/

Reply via email to