How to update (append to) an href in jquery?

后端 未结 4 576
悲&欢浪女
悲&欢浪女 2020-11-27 15:19

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-Loca

4条回答
  •  爱一瞬间的悲伤
    2020-11-27 16:15

    jQuery 1.4 has a new feature for doing this, and it rules. I've forgotten what it's called, but you use it like this:

    $("a.directions-link").attr("href", function(i, href) {
      return href + '?q=testing';
    });
    

    That loops over all the elements too, so no need for $.each

提交回复
热议问题