gpt4 book ai didi

jQuery 验证 1.9.0 和 jQuery 1.7.1

转载 作者:行者123 更新时间:2023-12-01 02:47:04 25 4
gpt4 key购买 nike

我已经使用 jQuery 1.7.1 在页面上设置了 jQuery 验证,如下所示。

<html>
<head>
<script src="jquery-1.7.1.js" type="text/javascript"></script>
<script src="jquery.validate-1.9.0.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#form1").validate();
});
</script>
</head>
<body>
<form id="form1">
<div>
<p>
<input id="form1input1" name="11" class="required" />
</p>
<p>
<input id="form1input2" name="12" class="required email" />
</p>

<input type="submit" value="Validate form 1">
</div>
</form>
</body>
</html>

这些字段会在提交表单时验证,但不会在模糊/keyup 时验证。

如果我将 jQuery 1.7.1 替换为 jQuery 1.3.2,则该插件将按照模糊/keyup 验证记录的方式工作。

这是兼容性问题吗?我在 GitHub 问题跟踪器 https://github.com/jzaefferer/jquery-validation 中找不到任何错误/开放票证

最佳答案

使用此组合,您必须输入上指定type属性:

<form id="form1">
<div>
<p>
<input id="form1input1" name="11" class="required" type="text" />
</p>
<p>
<input id="form1input2" name="12" class="required email" type="text" />
</p>

<input type="submit" value="Validate form 1">
</div>
</form>

示例: http://jsfiddle.net/5au9m/

插件作者 (Jörn Zaefferer) 认为这实际上是由于 jQuery 中发生的更改所致:

Afaik this works fine as long as your inputs have a type attribute. While inputs without a type attribute default to text, jQuery doesn't think so and ignores them. That was the problem on the demos, see 5f4a3a5 and 9050de7.

Let me know if thats also the issue you're seeing.

来源:Issue filed on github .

关于jQuery 验证 1.9.0 和 jQuery 1.7.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8981246/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com