验证代码lay-verify=“user_agree”
<div class="layui-form-item">
<label for="user_phone" class="layui-form-label" style="width: 20%;"></label>
<div class="layui-input-inline">
<input type="radio" id="user_agree" name="user_agree" value="1" lay-skin="primary" lay-verify="user_agree" title="我已经阅读并接受">
</div>
<div class="layui-form-mid layui-word-aux" style="margin-left: -50px;"><a href="index.php?m=Pop&a=privacy" target="_blank">《隐私政策》</a> <a href="index.php?m=Pop&a=agreement" target="_blank">《用户协议》</a><a href="index.php?m=Pop&a=sensitive" target="_blank">《敏感个人信息授权书》</a></div>
</div>
验证函数
//自定义验证规则
form.verify({
user_card: [/(^\d{15}$)|(^\d{17}(x|X|\d)$)/, "请输入正确的18位身份证号"]
, user_phone: [/^1[3|4|5|6|7|8|9]\d{9}$/, '手机必须11位,只能是数字!']
, smscode: [/^\d{6}$/, "验证码为6位数且5分钟内有效"]
, pass: [/(.+){6,12}$/, '密码必须6到12位']
, user_agree: function () {
if ($('input[name="user_agree"]:checked').val() != 1) {
return '必须通过服务条款《隐私政策》、《用户协议》 、《敏感个人信息授权书》';
}
}
, repass: function () {
if ($('#L_pass').val() != $('#L_repass').val()) {
return '两次密码不一致';
}
}
});
@lockdata.cn