내 코드에 어떤 문제가 있는지 잘 모르겠습니다. jquery 모바일 및 첫 번째 유효성 검사시 두 가지 양식을 사용하고 있습니다. 앵커 태그를 클릭 할 때 유효성 검사가 성공적으로 수행되면 # page2에 양식 2로 이동하거나 유효성 검사가 실패하면 계속 진행하고 싶습니다. 현재 페이지. 문제는 첫 번째 양식의 모든 데이터가 정확하면 두 번째 양식으로 이동할 수 있지만 올바르지 않으면 event.preventDefault()가 실행되고 올바르게 양식을 채우면 나에게 보내지 않을 것입니다. 형태 2.첫 번째 양식 유효성 검사 후 두 번째 양식으로 이동 javascript
<form action="#" method="post" data-ajax="false">
<span class="error_form" id="username_error"></span>
<label for="username">Username : <span></span></label>
<input type="text" name="username" id="username" placeholder="Enter username" value="">
<span class="error_form" id="password_error"></span>
<label for="password">Create password : <span></span></label>
<input type="password" name="password" id="password" placeholder="Enter password">
<span class="error_form" id="password_error_confirmation"></span>
<label for="passwordAgain">Confirm password : <span></span></label>
<input type="password" name="password_confirmation" id="password_confirmation" placeholder="Enter password again">
<div class="ui-grid-a">
<div class="ui-block-a">
<a href="#" data-role="button" data-icon="arrow-l" data-iconpos="left" data-transition="pop">Back</a>
</div>
<div class="ui-block-b">
<a href="#page3" id="register1" data-role="button" data-icon="arrow-r" data- iconpos="right" data-transition="pop">Next</a>
</div>
</div>
</form>
script.js, I have tried it with event.PreventDefault()
and it doent work
$('a#register1').click(function(event){
check_username();
check_password();
check_password_confirmation();
if(error_username == false && error_password == false && error_password_confirmation == false){
sessionStorage.setItem("username", $("#username").val());
sessionStorage.setItem("password", $("#password").val());
sessionStorage.setItem("password_confirmation", $("#password_confirmation").val());
$(this).attr("href", "#page3");
}else{
$(this).removeAttr("href");
}
});