自己写的,可用
<form role="form" id="signupForm">
{{ csrf_field() }}
<input name="name" id="name" value="" type="text">
<input name="price" id="price" value="" type="text">
<input name="supply_price" id="supply_price" value="" type="text">
<button class="btn btn-primary " type="submit">提交</button>
</form>
<script src="{{ asset('js/plugins/validate/jquery.validate.min.js')}}"></script>
<script src="{{ asset('js/plugins/validate/messages_zh.min.js')}}"></script>
<script>
$(function(){
var validate = $("#signupForm").validate({
debug: true, //调试模式取消submit的默认提交功能
//errorClass: "label.error", //默认为错误的样式类为:error
focusInvalid: false, //当为false时,验证无效时,没有焦点响应
onkeyup: false,
submitHandler: function(form){ //表单提交句柄,为一回调函数,带一个参数:form
var data=$("#signupForm").serialize();
console.log(data)
//form.submit(); //提交表单
},
rules:{
name:{
required:true,
email:true
},
price:{
required:true,
email:true
},
supply_price:{
required:true,
email:true
},
},
messages:{
name:{
required:"必填"
},
price:{
required:"必填"
},
supply_price:{
required:"必填"
},
}
});
})
</script>