jquery: modify multiple hrefs
<pre><code>jQuery("a.leftM").attr("href", "?g");
</code></pre>

<p>I have a few links on a page, to which I would like to <strong>add</strong> the parameter ?g. The sample above only replaces it. After some research I tried the following (which does not seem to work at all);</p>

<pre><code>$("a.leftM").each(function(){
    var x = this.attr("href");
    this.attr("href", x+"?g");
});
</code></pre>

<p>What am I missing here?
Is there a prettier/shorter way than to use a function?</p>

<p>Cheers H</p>
