Stop onClick from firing twice using jQuery
<p>I am using jQuery.post to perform an action when a user clicks an external link. I've attached an onClick event to the link:</p>

<pre><code>&lt;a id="lib-geo57" onClick="javascript:dConvert('lib-geo','57');"
</code></pre>

<p>The event fires, however this action should only be performed once. To avoid a second firing, I thought of removing the onClick attribute:</p>

<pre><code>function dConvert(a,k){
    $.post("dConverter",{aid:a,key:k});
    $("#"+a+k).removeAttr('onclick');
};
</code></pre>

<p>but that doesn't work. I also tried </p>

<pre><code>$("#"+a+k).attr('onclick','');
</code></pre>

<p>without success. The post function continues to work in both of the above examples. </p>

<p>Why can't I remove or change the onClick attribute? What would be a better strategy to prevent my post from executing more than once?</p>
