jQuery Validator插件字段名称,带有特殊字符 [英] jquery validator plugin field name with special characters
本文介绍了jQuery Validator插件字段名称,带有特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道如何获取jQuery的验证程序插件以识别带有特殊字符的输入字段名称吗?
Does anyone know how to get jQuery's validator plugin to recognize input field names with special characters?
我有一个使用以下字符生成表单字段的框架:[].示例:
I have a framework that is generating a form field with these characters: []. Example:
<input type="text" name="user[firstname]" id="user-firstname" />
使用Jorn的插件时,该字段将被忽略.
When using Jorn's plugin, the field is disregarded.
rules: { user[firstname]: "required"}
无法识别.
但是,如果我从字段名称中删除[]并相应地更改要求,那就没问题了.
But, if I remove the [] from the field name and change the requirement accordingly, no problem.
有人知道如何逃避方括号吗?
Anyone know how to escape the square brackets?
谢谢!
推荐答案
您可以尝试rules: { "user[firstname]": "required"}
这篇关于jQuery Validator插件字段名称,带有特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文