사용자가 양식을 제출하기 전에 양식을 클릭 할 때 지연을 설정하려고합니다. 클릭 이벤트를 테스트하기 위해 표시되는 이미지가 있지만 정상적으로 작동하지만.submit() setTimeout 후 양식을 제출하지 않음
<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();
}
나는이 오류 메시지를 받았습니다 :
,691 형태는 여기 내 HTML 양식입니다 ... 제출하지 않습니다
Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function
글쎄,'.delay (2000). $ ('. loginForm1')'은 틀린 문법이고 .delay()는 애니메이션 만 지연시킨다. 질문 제목에 제안 된대로 setTimeout을 사용해야합니다. –
두 개의 여는 '
srry가 잘못된 코드를 추가했습니다 ... 여기에 내가 문제가 생겼습니다 –