Jquery验证无法使用引导
您好,我正在使用jquery进行简单的表单注册验证。唯一的问题是我使用了引导框架 当我点击注册按钮时,不会发生任何事情 在fire bug控制台中显示Jquery验证无法使用引导,jquery,validation,twitter-bootstrap,jquery-validate,Jquery,Validation,Twitter Bootstrap,Jquery Validate,您好,我正在使用jquery进行简单的表单注册验证。唯一的问题是我使用了引导框架 当我点击注册按钮时,不会发生任何事情 在fire bug控制台中显示 [09:35:37.239] Empty string passed to getElementById(). @ http://www.matrimonyteam.com/home/registration 有关更多信息,请访问此url function register(){ var validator = $("#profile
[09:35:37.239] Empty string passed to getElementById(). @ http://www.matrimonyteam.com/home/registration
有关更多信息,请访问此url
function register(){
var validator = $("#profileRegistrationForm").validate({
rules: {
firstName: "required",
lastName: "required",
email: "required",
loginPassword: "required",
mobileNumber: "required",
gender: "required",
birthDate: "required",
motherTongue: "required"
},
errorElement: "span",
messages: {
firstName: "Enter First Name",
lastName: "Enter Last Name",
email: "Enter Valid Email Address",
loginPassword: "Enter Password",
mobileNumber: "Enter Mobile Number",
gender: "Select Your Gender",
birthDate: "Select Birth Date",
motherTongue: "Select Mother Tongue"
}
});
if(validator.form()){
$('form#profileRegistrationForm').attr({action: '/home/saveprofile'});
$('form#profileRegistrationForm').submit();
}
}
单击事件已注册
<script type="text/javascript">
$(document).ready(function () {
$('#register').click(function() {
register();
});
</script>
$(文档).ready(函数(){
$(“#寄存器”)。单击(函数(){
寄存器();
});
我认为您使用的是jquery 1.9之后的较新版本
$。浏览器
已删除
您可以下载验证插件的最新版本(当前版本:1.11.1)来解决此问题。
或者您可以使用CDN
http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js
或者从
阅读和
也请阅读我在之前看到了其他错误…@SethMcClaine,在jquery验证中添加了附加检查$.browser&$.browser.msie..但理想情况下我不应该接触核心库…现在它可以工作了,谢谢