除提交功能外,此代码运行平稳。如果我用另一个函数如“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