除提交功能外,此代碼運行平穩。如果我用另一個函數如「show();」來更改提交函數有用。爲什麼不運行這個提交函數? jQuery的:這個jQuery提交函數有什麼問題?
$(document).ready(function(){
$('#submit').click(function(){
var email = $('#email').val();
email = $.trim(email);
var password = $('#password').val();
password = $.trim(password);
if(email == "" || password == "") {
$('.division').show();
}else{
$('#form').submit();
}
})
});
這是我的形式:
<form id="form" method="post" action="run.php">
<input type="text" id="email" name="email">
<input type="password" id="password" name="password">
<input type="checkbox" checked="checked" id="keep" value="yes">
<label for="keep">Keep login</label>
<input type="submit" id="submit" value="Sign in" onClick="return false;">
</form>
謝謝你,我做到了。 – nijamitsu 2014-08-28 17:52:38