How do i add some address to the value of the link below using jquery? like http://maps.google.com/maps?q=indianapolis
<div class="driving-directions-link">
<a href="http://maps.google.com/maps?q=">Get Direction</a>
</div>
$("div.driving-directions-link > a").prop("href", function (index, oldHref) {
return oldHref + "indianapolis";
});
Check out .prop
, which can take a function where oldHref
is well, the old href
.
Example: http://jsfiddle.net/c5VNK/