我正在使用Twitter BootStrap在ASP.NET MVC 3项目中。它使用jquery-unobtrusive-validation.js进行不引人注目的验证,并在内部实现了.live()方法。要使其工作,需要版本小于1.7的jQuery文件,因为.live()是从版本1.7中删除的。
对于twitter,bootstrap.js文件中有.on()方法,该方法需要jquery文件的版本1.7+。
因此,最后的问题是,如果我添加jquery-1.5.0.js,引导程序不能正常工作,而当我添加jquery-1.9.0.js,时,不引人注目的验证就不起作用了。如何引用两个jQuery文件,或者如何解决这个问题?请帮帮忙。提前谢谢。
发布于 2013-08-08 23:09:54
打开"jquery.validate.unobtrusive.js",从以下位置更改最后一行:
}(jQuery));
至
}(oldJQuery ));
现在,您可以像这样使用这个老插件:
<script type="text/javascript" src="../../script/jquery-1.5.0.min.js"></script>
<!-- store and protect the old one -->
<script>
var oldJQuery = jQuery.noConflict();
</script>
<script type="text/javascript" src="../../script/jquery.validate.unobtrusive.js"></script>
<!-- load the new version and required plugins -->
<script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../../script/bootstrap.js"></script>
https://stackoverflow.com/questions/18118990
复制相似问题