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.
我有一个简单的 jQuery 验证规则,它强制名字至少有 2 个字符长(错误行为)。我想允许名字是单个字符。
rules: { firstname:{ required:true, accept: "[a-zA-Z `'-]+" }
试试这个
rules: { firstname:{ required:true, minlength: 0, accept: "[a-zA-Z `'-]+" }
将最小长度设置为 0。