title: How to display a confirmation dialog when clicking an <a> link?
body: <p>I want this link to have a JavaScript dialog that asks the user “<em>Are you sure? Y/N</em>”.</p>
  
  <pre><code>&lt;a href="delete.php?id=22"&gt;Link&lt;/a&gt;
  </code></pre>
  
  <p>If the user clicks “Yes”, the link should load, if “No” nothing will happen.</p>
  
  <p>I know how to do that in forms, using <code>onclick</code> running a function that returns <code>true</code> or <code>false</code>. But how do I do this with an <code>&lt;a&gt;</code> link?</p>