标签:require class nbsp turn date test doc ons ora
<input id="idcardcode" name="idcardcode" class="form-control"
type="idcardvalidate" required="证件号码不能为空"
data-options="required:true,validType:‘idcard‘">
<input id="contactphone" type="phonevalidate"
class="form-control" name="contactphone" required="电话不能为空"
data-options="required:true,validType:‘mobileOrphone‘">
<script type="text/javascript">
$(document).ready(function(){
jQuery.validator.addMethod("idcardvalidate", function(value, element) {
return /^\d{15}(\d{2}[A-Za-z0-9])?$/i.test(value);
}, "请填写有效的身份证");
jQuery.validator.addMethod("phonevalidate", function(value, element) {
return /^([+]?[0-9]){11}$/i.test(value);
}, "请填写有效的电话号码");
});
//提交表单按钮方法form1为表单form的id,valid()方法返回的是布尔值当都正确了才能提交
function tjsj(){
var formpanding=$("#form1").valid();
if(){}
}
</script>
标签:require class nbsp turn date test doc ons ora
原文地址:http://www.cnblogs.com/niuxi/p/6024530.html