jQuery验证在IE或Chrome中不起作用
我在做基本的表单验证。它在Firefox中工作得非常好,但在Chrome或IE中则不行——在这种情况下,当我点击submit时,它会将我带到表单标签的action param中的url jQuery:jQuery验证在IE或Chrome中不起作用,jquery,internet-explorer,google-chrome,jquery-validate,Jquery,Internet Explorer,Google Chrome,Jquery Validate,我在做基本的表单验证。它在Firefox中工作得非常好,但在Chrome或IE中则不行——在这种情况下,当我点击submit时,它会将我带到表单标签的action param中的url jQuery: $(document).ready(function() { $("#booking_form").validate({ errorContainer: "#errors", errorLabelContainer: "#errors ul",
$(document).ready(function() {
$("#booking_form").validate({
errorContainer: "#errors",
errorLabelContainer: "#errors ul",
wrapper: "li",
messages: {
from_day: "Please specify the day of your arrival",
from_month: "Please specify the month of your arrival",
from_year: "Please specify the year of your arrival",
to_day: "Please specify the day of your departure",
to_month: "Please specify the month of your departure",
to_year: "Please specify the year of your departure",
room: "Please choose a room type",
breakfast: "Please specify whether or not you wish to receive breakfast"
}
});
});
HTML:
进站
如果这是我认为是的验证插件,那么所有应该验证的字段都必须具有“required”类,否则它们将被忽略
例如:
<input type="text" class="required" />
<input type="text" class="required email" />
它也应该与select一起使用
<select class="required">
<option value="1">One</option>
...
</select>
一个
...
是否已清除缓存并重试?检查脚本错误。如果出现错误,IE将停止工作。奇怪的是,Chrome和IE都无法访问远程jQuery链接。我把它们存放在本地,现在一切正常。感谢您的帮助。下面是对生成的HTML的修改,包括问题中指定的脚本:
<input type="text" class="required" />
<input type="text" class="required email" />
<select class="required">
<option value="1">One</option>
...
</select>