我已经尝试了以下代码,但它不工作.我的代码中正则表达式的问题或编写自定义规则的方式是否错误?
rules: { paid_amount: { required:true,rexp: ^[1-9]\d*(\.\d+)?$ },} },messages: { paid_amount: { required: "Enter Paid Amount",rexp:"Decimal Numbers Only" },} });
从文档:
$("#myform").validate({ rules: { field: { required: true,number: true } } });
在你的情况下:
rules: { paid_amount: { required:true,number: true } },messages: { paid_amount: { required: "Enter Paid Amount",number: "Decimal Numbers Only" } }