title: Set onclick event using script
body: <p>I want to make my <code>script</code> set the <code>onclick</code> properity of a <code>&lt;div&gt;</code>.</p>
  
  <p>I use this Html code:</p>
  
  <pre><code>&lt;div id="forgotpass"&gt;Forgot Password?&lt;/div&gt;
  </code></pre>
  
  <p>I want when a user clicks the <code>&lt;div&gt;</code> a <code>forgotpass()</code> function to run, but I do not want to use this:</p>
  
  <pre><code>&lt;div id="forgotpass" onclick="forgotpass();"&gt;Forgot Password?&lt;/div&gt;
  </code></pre>