【发布时间】:2011-05-16 23:56:09
【问题描述】:
我想更改所有包含“foobar.com/?”的链接用 jquery 为 "&t=test" ("foobar.com/?&t=test") 做广告。
这是我拥有的似乎不起作用的代码。 ->
$('a[href*="foobar.com/?"]').attr(href).append('&t=test');
我的代码有什么问题?或者更改所有链接的更合适的方法是什么?
【问题讨论】:
我想更改所有包含“foobar.com/?”的链接用 jquery 为 "&t=test" ("foobar.com/?&t=test") 做广告。
这是我拥有的似乎不起作用的代码。 ->
$('a[href*="foobar.com/?"]').attr(href).append('&t=test');
我的代码有什么问题?或者更改所有链接的更合适的方法是什么?
【问题讨论】:
这是怎么做的
$('a[href*="foobar.com/?"]').each(function(){
this.href += '&t=test';
});
【讨论】: