javascipt申请表单上的验证器和自定义输入时的警告消息。$(document).ready(function() {// Generate a simple captchafunction randomNumber(min, max) {return Math.floor(Math.random() * (max - min + 1) + min);};$('#captchaOperation').html([randomNumber(1, 100), '+', randomNumber(1, 200), '='].join(' ')); $('#defaultForm').bootstrapValidator({message: 'This value is not valid',fields: {username: {message: 'The username is not valid',validators: {notEmpty: {message: 'The username is required and can\'t be empty'},stringLength: {min: 6,max: 30,message: 'The username must be more than 6 and less than 30 characters long'},regexp: {regexp: /^[a-zA-Z0-9_\.]+$/,message: 'The username can only consist of alphabetical, number, dot and underscore'},different: {field: 'password',message: 'The username and password can\'t be the same as each other'}}},email: {validators: {notEmpty: {message: 'The email address is required and can\'t be empty'},emailAddress: {message: 'The input is not a valid email address'}}},password: {validators: {notEmpty: {message: 'The password is required and can\'t be empty'},identical: {field: 'confirmPassword',message: 'The password and its confirm are not the same'},different: {field: 'username',message: 'The password can\'t be the same as username'}}},confirmPassword: {validators: {notEmpty: {message: 'The confirm password is required and can\'t be empty'},identical: {field: 'password',message: 'The password and its confirm are not the same'},different: {field: 'username',message: 'The password can\'t be the same as username'}}},captcha: {validators: {callback: {message: 'Wrong answer',callback: function(value, validator) {var items = $('#captchaOperation').html().split(' '), sum = parseInt(items[0]) + parseInt(items[2]);return value == sum;}}}}}});});
文件目录······
暂无数据
猜你喜欢
更多»
项目推荐
更多»
PDF电子书
更多»
Java多线程编程核心技术
(2)
Linux命令详解词典.pdf
(5)
深入Python3中文版
(0)
百度SEO一本通.pdf
(0)
mysql必知必会.pdf
(2)
疯狂JAVA讲义 pdf电子书
(3)
C# 图解教程pdf电子书
(3)
研磨设计模式 pdf电子书
(0)