当用户在提交之前单击表单上的提交时,我试图设置延迟。我有一个显示的图像来测试点击事件,它工作正常,但表单从不提交......
这是我的 HTML 表单:
<form class='loginForm1' action='verify_credentials.php' method='post'>
<fieldset>
<legend>Log into Answer Tree</legend>
<label>Username</label>
<input class='inputs' name='username' type="text" placeholder="Enter username...">
<label>Password</label>
<input class='inputs' name='password' type="text" placeholder="Enter password...">
<label class="checkbox">
<input type="checkbox">Remember me</label>
<button id='submit' type='button' class="btn btn-success">Submit</button>
</fieldset>
</form>
这是脚本:
$(document).ready(function () {
$(".containerLogin img").hide();
});
$(function () {
$("#submit").click(function () {
$(".containerLogin img").show();
setTimeout(submitForm, 1000);
});
});
function submitForm() {
$(".loginForm1").submit();
}
我收到此错误消息:
Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function