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';
});
精彩评论