简体   繁体   中英

JQuery Validate Plugin Safari

I am using the JQuery Validation plugin for a form. It works perfectly for Chrome, however, it does not work at all for Safari. I am not sure why this would be the case. Any suggestions?

Here is my code:

<form class="form-horizontal" id="contact-form" action="index.php" method="post">
    <?php if ($good_input){ ?>
            <div class="alert alert-success">
            <a class="close" data-dismiss="alert" href="#">&times;</a>
            Thank you for contacting us! We will get back to you as soon as possible.
            </div>
   <?php } ?>
<div class="control-group">
        <label class="control-label" for="name">Name*</label>
    <div class="controls">
        <input type="text" name="name" placeholder="Name" required>
    </div>
</div>
<div class="control-group">
        <label class="control-label" for="comments">Comments*</label>
    <div class="controls">
        <textarea rows="5" name="comments" required></textarea>
    </div>
</div>
<div class="btn-submit">
    <button type="submit" id="submit" class="btn btn-block btn-lg btn-success">Submit</button>
    </div>
</form>

And my jQUERY validation code:

<script>
$().ready(function() {
$("#contact-form").validate();
});
</script>

确保Validate插件遵循您代码中的jQuery JavaScript。

这是因为Safari不像其他Web浏览器那样支持HTML5表单验证,由于某些原因,开发人员看不到HTML5的强大功能以及它如何使提交表单变得如此容易,因此不得不制定函数来检查和查看浏览器是Safari,所以现在我想是因为Safari不支持HTML5表单,或者因为我曾经/也遇到同样的问题而无法找到它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM