title: Simple way to hash password client side right before submitting form
body: <p>Without any common JS libraries, how can I hash a password before sending it?</p>
  
  <pre><code>&lt;form&gt;
      &lt;input type="password" id="pwd" name="password" /&gt;
      &lt;input onclick="
  var val = document.getElementById('pwd').value;
  document.getElementById('pwd').value(sha512(val));"
       type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>That would somehow be my naive way to do it (with sha512 being a function defined somewhere to create the sha512 value)</p>
  
  <p>Though it obviously does not seem to work. Why? How do I do this right and simple?</p>