开发者

How to append a link's HREF with jquery?

I want to change all links containing "foobar.com/?" to ad "&t=test" ("foobar.com/?&t=test") with jquery.

This is the code I have that does not seem to work. ->

$('a[href*=开发者_StackOverflow"foobar.com/?"]').attr(href).append('&t=test');

What is wrong with my code? Or what is a more proper way to change all the links?


this is how to do it

$('a[href*="foobar.com/?"]').each(function(){
  this.href += '&t=test';
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜