【问题标题】:jQuery Validate not working in IE8 and SafarijQuery Validate 在 IE8 和 Safari 中不起作用
【发布时间】:2013-04-20 15:43:56
【问题描述】:

jQuery Validate 在 Firefox 和 Chrome 中运行良好,可以验证客户端并将 POST 发送到 php 电子邮件功能。但在 IE8 和 Safari 中,它会直接跳到服务器端验证,因此用户必须使用“后退”按钮来填写必填字段。

这是我的代码:

<script type="text/JavaScript">
$(document).ready(function() {
    $("form1").validate( {
        rules: {
            name: {
                required: true
                },
            email: {
                required: true
                }
        }
    )};
});
</script>

这里是 HTML:

<form class="cmxform" action="" method="post" name="WCForm" id="form1" />
<fieldset>
<input name="name" type="text" required="required" id="name" size="25" />

我错过了什么?提前致谢!

【问题讨论】:

  • 回复发生了什么?我是不是做错了什么?

标签: jquery validation internet-explorer-8 safari


【解决方案1】:

首先,选择器的 id 应该有一个 #:

$("#form1")

另外,输入不应该在表单内部,而不是让表单标签自动关闭吗?

<form class="cmxform" action="" method="post" name="WCForm" id="form1">
    <input name="name" type="text" required="required" id="name" size="25" />
</form>

【讨论】:

    猜你喜欢
    • 2011-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-03
    • 2013-06-18
    相关资源
    最近更新 更多