title: Javascript Encrypt pass before POST
body: <p>I am trying to encrypt a password when submit button is pressed.</p>
  
  <p>I don't understand why the value of password input is not changed, the ecryption is done correctly.</p>
  
  <pre><code>&lt;script&gt;
      function cript(){
          var pass = CryptoJS.SHA1("&lt;?php echo $_POST["password"]; ?&gt;");
  
          var passString = pass.toString();
  
          console.log(passString);
          document.getElementById('inputPassword').value = passString;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>and on HTML Form:</p>
  
  <pre><code>&lt;input type="submit" class="btn btn-primary" value="Proceed" onclick="cript()"&gt;
  </code></pre>
  
  <p>Can anyone tell me the solution?</p>