我在 ejs 模板中定义了一个 javascript 函数,并希望在提交表单时调用此函数
但它没有调用 checkPassword 函数。
我在这里错过了什么吗?
register.ejs
<html>
<head>
<script type="text/javascript">
function checkPassword()
{
console.log("=============");
const password = document.getElementsByName('password').value;
console.log(password);
console.log(form);
return true;
}
</script>
</head>
<body>
<form onSubmit="return checkPassword()">
... <-- get password and password confirm input
<button class="btn btn-lg btn-info mt-4">Sign Up</button>
</form>