Thursday, November 28, 2013

Adding parameters to an existing link

I'm working on a project where the user selects a date and then clicks a link.  The date needs to be added as a parameter to the link's url.  The normal way to do this would be with a form.  But each link would then have to be a submit button.  I don't want them to look like submit buttons.  But I also don't want to restyle them to look like links.  So I set out to find a way to dynamically add the date to each link.

Turns out with jquery it's pretty easy.  Check it out...
Update: okay, another easy way to do this would be to leave the links as links but put the parameters, including the date, in a form, then trap the click event on the link and submit the form. But what's cool about that?