我有一些代码给我一个问题。由于某种原因,此jquery所附加的表单需要双击。我做了一些研究并了解了提交事件处理程序,但是从代码中可以看出,我没有。我只想让表单提交而无需用户点击2次。提前谢谢。
$(document).ready(function() {
function func1(field,message) {
$(field).hover(function() {
$('#submenu').stop().fadeIn();
$('#submenu').html(message);
}, function() {
$('#submenu').stop().fadeOut();
});
}
func1('#first_name','This is the first name field.');
func1('#last_name','This is the last name field.');
func1('#username','Username may be letters and numbers.');
func1('#password','This is the password field. Please remember to include at least one special character and one number in your password.');
func1('#email','Please insert a valid e-mail address.');
$('#customerForm').validate({
rules: {
email: {
required: true,
email: true,
rangelength:[1,50],
remote: "/nwrs8-20-2015/php_validation_scripts/check_email_field.php"
},
password: {
required: true,
rangelength:[6,18],
remote: "/nwrs8-20-2015/php_validation_scripts/check_password_field.php"
},
username: {
required: true,
rangelength:[6,18],
remote: "/nwrs8-20-2015/php_validation_scripts/check_username_field.php"
},
last_name: {
required: true,
rangelength:[1,50],
remote: "/nwrs8-20-2015/php_validation_scripts/check_last_name_field.php"
},
first_name: {
required: true,
rangelength:[1,50],
remote: "/nwrs8-20-2015/php_validation_scripts/check_first_name_field.php"
},
date_paid: {
required: true,
rangelength:[8,10],
remote: "/nwrs8-20-2015/php_validation_scripts/check_date_paid.php"
},
membership_expiration: {
required: true,
rangelength:[8,10],
remote: "/nwrs8-20-2015/php_validation_scripts/check_date_expired.php"
}
}
})
});
答案 0 :(得分:0)
现在,我再次看一遍,似乎第一次点击即可。这很奇怪,有时我会发誓它需要2次点击,但也许这只需要一段时间来处理。