Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议在Validator.element下获取Item的DOM元素 #46

Closed
luffyfly opened this issue Aug 22, 2013 · 1 comment
Closed

建议在Validator.element下获取Item的DOM元素 #46

luffyfly opened this issue Aug 22, 2013 · 1 comment

Comments

@luffyfly
Copy link
Contributor

当页面上存在多个name相同的元素时,多个表单的validator之间会相互冲突。

https://github.com/aralejs/validator/blob/master/src/item.js#L24

var element = $(this.get('element')),
      type = element.attr('type'); 

将$(this.get('element'))改成类似与$(this.get('element'), validator.element)。

在富客户端程序中,经常有多个同类型的表单同时存在的情况,最好能避免相互之间的冲突。

@lizzie
Copy link
Member

lizzie commented Aug 22, 2013

这边的 this.get('element') 就是当前 Item 的 element , 他这边写绕了, 直接 this.element 即可.

你的问题, name 多个, 应该是再传入 element 参数时区分 选择器

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants