[stackoverflow] intercepting form submit

HTML

<form id="form" action="http://www.google.com.my" method="POST">
    <input id="username" type="email" name="username" placeholder="Username">
    <input id ="password" type="password" name="password"placeholder="Password">
    <input type="hidden" id ="therealdeal" name="realpassword">
    <button id="post" type="button">Submit</button>
</form>

JavaScript

$('#post').click(function(e) {
    var password = $("#password");
    var realPassword = $("#therealdeal");
    realPassword.val(password.val());
    password.val('');
    $('#form').submit();
});