旧版本与新版本的jQuery冲突 [英] Older version conflicting with newer version of jquery

查看:161
本文介绍了旧版本与新版本的jQuery冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我陷入jquery插件的主要问题.我有一些用jquery 1.7.1编写的代码,现在我开始使用引导程序,并且需要1.9.1或更高版本的jquery插件.

I am stuck in a major issue with jquery plugins. I have some code written with jquery 1.7.1, now I started using bootstrap and that need 1.9.1 jquery plugin or higher.

包含此版本后," https://ajax .googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js ",我以前的功能停止了工作.然后我使用了两个版本,但再没有运气了.

After including this version "https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js ", my previous functionality stopped working. Then I used both versions but no luck again.

我不想重写我以前的代码以使其与新版本兼容.请提供解决方案

I don't want to rewrite my previous code to make it compatible with new version. Please provide solution

我遇到许多错误,例如:未捕获的TypeError:that.errorDialog.dialog不是函数,.live不是函数,.dialog没有定义,null错误.我的代码与jQuery 1.7.1正常工作时出现错误

I am getting many errors like: Uncaught TypeError: that.errorDialog.dialog is not a function, .live is not a function,.dialog is not defined , null errors. I am getting errors with my code that is working fine with jQuery 1.7.1

如何解决此问题,请帮忙.

How do I fix this please help.

谢谢! 迪皮卡(Deepika)

Thanks! Deepika

推荐答案

您可以尝试仅加载jQuery的较新版本,然后再加载jquery-migrate,这将恢复一些旧功能.但是,在不知道您的应用需要哪些特定功能的情况下,我不确定这是否可以解决问题.

You can try loading just the newer version of jQuery then loading jquery-migrate which will restore some old functionality. However, without knowing what specific features your app needs, I can't be sure that this will solve the problem.

https://cdnjs. cloudflare.com/ajax/libs/jquery-migrate/1.2.1/jquery-migrate.min.js

但是理想情况下,您应该真正识别依赖于旧版jQuery的代码,并对其进行更新以与最新版本一起使用.归根结底,对jQuery的更改是有原因的.使用新的实现,您几乎肯定会更好.

Ideally though, you should really identify the code that relies on older versions of jQuery and update them to work with the newest version. At the end of the day, the changes to jQuery were made for a reason. And you're almost certainly better off with the new implementations.

如果您明智地决定更新代码,则可能会 jQuery Core 1.9升级指南成为一个很好的起点

If you smartly decide to update your code, the jQuery Core 1.9 Upgrade Guide would likely be a good place to start

这篇关于旧版本与新版本的jQuery冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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