$ ("#login_btn"). Click (function () {Type is the button under Submit if ($ ("#id_password"). Val (). length = = 0) {// Verify that password is empty $ (' form '). Submit (function () { alert ("1") return false; }); else if ($ ("#vali"). val ()! = code) {//Verify that the code is correct $ (' form '). Submit (function () { alert ("2") return false; }); }else{ $ (' form '). Submit (function () { alert ("3") return true;} ); } );
When the test is found, when the password is empty, the popup 1, and then click once. Popped two times 1. Click again, pop up three 1; Enter password. Click again to find pop-up 1, 1. 1. 2, looking for a long time do not know why
Change strategy later
<pre name= "code" class= "HTML" >$ (' form '). Submit (function () { var b = true; if ($ ("#id_password"). Val (). length = = 0) { $ ("#verify"). html (' <div class= ' alert alert-error ' > Please enter your password!</ Div> '). Show (); b = false; } else if ($ ("#vali"). val ()! = code) { $ ("#verify"). html (' <div class= ' alert alert-error ' > CAPTCHA input Error!</div> '). Show (); b = false; } else{ B = true; } return b; });
So that I can, I don't know why ~ ~ ~ Ask for answers
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
jquery is using the submit issue in form, not resolved