jQuery("a.leftM").attr("href", "?g");
I have a few links on a page, to which I would like to add the parameter ?g. The sample above only replaces it. After some research I tried the following (which does not seem to work at all);
$("a.leftM").each(function(){
var x = this.attr("href");
this.attr("href", x+"?g");
});
What am I missing here?
Is there a prettier/shorter way than to use a function?
Cheers H
use
$(this).attr()instead ofthis.attr()