开发者

jQuery Validation plug-in that works with dynamic controls

I've tried the plug-in found here, but I can't get it to work with dynamic controls开发者_高级运维.

What are some other validators that will work with dynamic controls?

Dynamic Example: http://jsfiddle.net/wY6xt/2/


If you do 'inspect element' in FF you see that all new inputs do have 'error' class added if empty, but since all inputs have the same name, error message only shows once. If you call dynamic field something else it will show twice (once for static input, once for first dynamic one. Now if you have all inputs named differently (and you need that anyway) it'll work fine.


There are a couple ways you can accomplish this.

  • When adding the inputs dynamically, use the .rules() method to add the appropriate validation rules.
  • Add classes to the inputs, e.g. <input type="text" ... class="required email">


haven't you tried the dynamic demo ? It works very well... What are your requirements ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜