Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用插件验证和掩码。
在输入字段中,我需要允许这些格式的数字:
123,12 1 234,99 687 542,85
我试过这个选项:“必需”:真, “数字”:真
我该怎么做?
我找到了答案:
$.validator.methods.number = function (value, element) { return this.optional(element) || /\d{1,3}(\.\d{3})*(\.\d\d)?|\.\d\d/.test(value); }
接着 :
$("#myform").validate({ ignoreTitle: true, rules: { "myfield": { "required": true, "number": true }, ....