title: How do you override inline onclick event?
body: <p>This seems deceptively simple.</p>
  
  <p>How do you override the onclick event in the following HTML using JavaScript?</p>
  
  <pre><code>&lt;a id="sample" href="..." onclick="alert('hello world')" /&gt;...&lt;/a&gt;
  </code></pre>
  
  <p>I've tried it with jQuery, but that didn't do the trick:</p>
  
  <pre><code>$('#sample').attr('onclick','alert("done")')
  </code></pre>
  
  <p>Assume the HTML is pre-written and cannot be changed, other than manipulating it with JavaScript.</p>