less than 1 minute read

Assume that the <form id="loginForm"></form> exist and other input values included

const password = "";
$("#loginForm").attr("action", "/auth/login");
$("#loginForm").attr("method", "POST");

//add custom value with hidden field
const param_password = $("<input type='hidden' value=" + password + " name='loginPass' readonly>");
$("#loginForm").append(param_password);
$("#loginForm").submit();

Comments