How to update an existing a href attribute?
<p>I’m newbie when it comes to jQuery so here is my newbie question ;-) :
How to update the existing a href onclick attribute with a new value?
I want to insert the Google link-tracker on all existing links.
HTML:</p>

<pre><code>&lt;div&gt;
    &lt;a href="http://www.example.com/files/map2.pdf" onclick="dwnlExe();"&gt;link&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>What I have so far:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    jQuery(document).ready(function() {

        var pathName = window.location.pathname
        var n = 1;
        $("a").each(
                function() {
                    if (($(this).attr("onclick")) == undefined) {
                        $(this).attr("onclick", "javascript: pageTracker._trackPageview('" + pathName + "-link-" + n + "');");
                    } else {
                    var onclickValue = $("a").attr("onclick");
                    // how to update the existing onclick="dwnlExe();"
                    // to onclick="dwnlExe(); javascript: pageTracker._trackPageview('" + pathName + "-link-" + n + "');"
                    }
                    n++;
                }
            );
    });
&lt;/script&gt;
</code></pre>
