Jquery 验证表单然后执行函数
我有以下问题。我希望通过单击按钮来验证表单,如果表单有效,则弹出叠加层。
$(document).ready(function() {
$('#submitButton').click( function(){
if ($("#EnquiryFormContact").checkValidity() == true) {
//If true call here
//alert("Form is good");
$("a[rel]").overlay({
mask: '#000'
})
}
else
{
//if false call here
alert("Form is bad");
}
//Return False to disable the submit but allow the button to be triggered.
return false;
});
});
我的代码不是那么好,我只是在学习,但任何帮助将不胜感激。
I have the following problem. I wish to validate the form by clicking on the button and if the form is valid make the overlay pop up.
$(document).ready(function() {
$('#submitButton').click( function(){
if ($("#EnquiryFormContact").checkValidity() == true) {
//If true call here
//alert("Form is good");
$("a[rel]").overlay({
mask: '#000'
})
}
else
{
//if false call here
alert("Form is bad");
}
//Return False to disable the submit but allow the button to be triggered.
return false;
});
});
My code is not that great and I am just learning but any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查这篇文章的 jQuery UI 部分:
http://www.jensbits.com/2009/08/10/modal-confirmation-dialog-on-form-submit-javascript-jquery-ui-and-thickbox-varieties/
它可能会指出你朝着正确的方向。
Check the jQuery UI section of this post:
http://www.jensbits.com/2009/08/10/modal-confirmation-dialog-on-form-submit-javascript-jquery-ui-and-thickbox-varieties/
It may point you in the right direction.