How to update (append to) an href in jquery?
Posted
by John Isaacks
on Stack Overflow
See other posts from Stack Overflow
or by John Isaacks
Published on 2010-05-10T19:20:23Z
Indexed on
2010/05/10
19:24 UTC
Read the original article
Hit count: 166
jQuery
I have a list of links that all go to a google maps api.
the links already have the daddr
(destination) parameter in them as static. I am using Geo-Location to find the users position and I want to add the saddr
(source address) to the links once I get the data.
so basically I will need to add something like &saddr=50.1234567,-50.03452
at the tail end of all the links pointing to google maps
All the links have a class called directions-link
and from this page I have figured out how to change them:
$("a.directions-link").attr("href", "http://www.google.com/");
However I only want to append my value to the end of the href without changing what the href already is.
How can I do that?
Thanks!!
© Stack Overflow or respective owner