jquery.validate.unobtrusive不动的工作注入的元素 [英] jquery.validate.unobtrusive not working with dynamic injected elements

查看:220
本文介绍了jquery.validate.unobtrusive不动的工作注入的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与 ASP.Net MVC3 工作,使用客户端验证更简单的方式将启用 jquery.validate.unobtrusive 。一切正常,对于东西,是从服务器的权利。

I am working with ASP.Net MVC3, the easier way to use the client validation would be enabling the jquery.validate.unobtrusive. Everything works fine, for stuff that's right from server.

但是,当我尝试注入一些新的输入与JavaScript的,我知道,我需要调用 $。validator.unobtrusive.parse()来重新绑定验证。但尽管如此,所有这些动态注入字段没有发挥作用。

But when I try to inject some new 'inputs' with javascript, and I knew that I need to call $.validator.unobtrusive.parse() to rebind the validations. But still, all those dynamic injected fields are not functioning.

更糟糕的是,我尝试使用 jquery.validate 手动绑定,它不工作要么。有什么想法?

Even worse, I try to manually bind using jquery.validate and it is not working either. Any thoughts?

推荐答案

我已经创建为解决这个问题对我的情况jquery.validate.unobtrusive库的扩展 - 它可能会感兴趣

I've created an extension for the jquery.validate.unobtrusive library that solved this problem for my situation - it might be of interest.

<一个href=\"http://xhalent.word$p$pss.com/2011/01/24/applying-unobtrusive-validation-to-dynamic-content/\">http://xhalent.word$p$pss.com/2011/01/24/applying-unobtrusive-validation-to-dynamic-content/

这篇关于jquery.validate.unobtrusive不动的工作注入的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆