Javascript ';成功';jquery表单验证清除并提交后的对话框-无论发生什么情况都显示成功消息

Javascript ';成功';jquery表单验证清除并提交后的对话框-无论发生什么情况都显示成功消息,javascript,jquery,forms,validation,jquery-validate,Javascript,Jquery,Forms,Validation,Jquery Validate,我有一个简单的电子邮件表单: <form method="post" action="process-form.php" id="emailForm" name="emailForm" target="_self"> <h4>Sign up to be notified when we go live!</h4> <label for="email">E-mail</label> <input type="text

我有一个简单的电子邮件表单:

<form method="post" action="process-form.php" id="emailForm" name="emailForm" target="_self">
    <h4>Sign up to be notified when we go live!</h4>
<label for="email">E-mail</label>
    <input type="text" name="email" id="email" />
<input type="submit" name="submit" id="submit" value="Submit"  onclick="return alert('Thanks! Your email has been added.');">

    <p>emails will not be shared with third parties</p>
</form>

注册以便在我们上线时收到通知!
电子邮件
电子邮件不会与第三方共享

我正在使用以下jQuery验证:

/*
Created 09/27/09                                        
Questions/Comments: jorenrapini@gmail.com                       
COPYRIGHT NOTICE        
Copyright 2009 Joren Rapini
*/  

$(document).ready(function(){
// Place ID's of all required fields here.
required = ["email"];
// If using an ID other than #email or #error then replace it here
email = $("#email");
errornotice = $("#error");
// The text to show up within a field when it is incorrect
emptyerror = "Please fill out this field.";
emailerror = "Please enter a valid e-mail.";

$("#emailForm").submit(function(){  
    //Validate required fields
    for (i=0;i<required.length;i++) {
        var input = $('#'+required[i]);
        if ((input.val() == "") || (input.val() == emptyerror)) {
            input.addClass("needsfilled");
            input.val(emptyerror);
            errornotice.fadeIn(750);
        } else {
            input.removeClass("needsfilled");
        }
    }
    // Validate the e-mail.
    if (!/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email.val())) {
        email.addClass("needsfilled");
        email.val(emailerror);
    }

    //if any inputs on the page have the class 'needsfilled' the form will not submit
    if ($(":input").hasClass("needsfilled")) {
        return false;
    } else {
        errornotice.hide();
        return true;
    }
});

// Clears any fields in the form when the user clicks on them
$(":input").focus(function(){       
   if ($(this).hasClass("needsfilled") ) {
        $(this).val("");
        $(this).removeClass("needsfilled");
   }
});
}); 
/*
创建于2009年9月27日
问题/评论:jorenrapini@gmail.com                       
版权公告
版权所有2009 Joren Rapini
*/  
$(文档).ready(函数(){
//在此处放置所有必填字段的ID。
必需=[“电子邮件”];
//如果使用的ID不是“电子邮件”或“错误”,请在此处替换
电子邮件=$(“#电子邮件”);
errornotice=$(“#错误”);
//字段中不正确时显示的文本
emptyerror=“请填写此字段。”;
emailerror=“请输入有效的电子邮件。”;
$(“#emailForm”).submit(函数(){
//验证必填字段

对于(i=0;i在onsubmit函数的末尾,返回“true”。

是否类似于alert(“谢谢”)?