简体   繁体   English

从jQuery 1.4.1迁移到1.9.1时JS只能部分工作

[英]js working only partially when migrated from jquery 1.4.1 to 1.9.1

I am really new to programming. 我真的是编程新手。 So please apologize if you find my question silly. 因此,如果您发现我的问题很傻,请向您道歉。

When I click a tab a table appears. 当我单击选项卡时,将出现一个表格。 That is the idea. 那是主意。

I have a js working perfectly fine like how I want when i include 我有一个js工作得很好,就像我想要的那样

jquery/1.4.1/jquery.min.js 的jquery / 1.4.1 / jquery.min.js

When I click on the tab it tab moves and a table appears, refer below link 当我单击选项卡时,它的选项卡移动并且出现表格,请参阅下面的链接

http://smartdentalgroup.co.uk/test1/schedule.html http://smartdentalgroup.co.uk/test1/schedule.html

but it works only partially when I include 但是当我包括时它仅部分起作用

jquery-1.9.1.min.js jQuery的1.9.1.min.js

when i click on the tab it moves but the table doesn't appear 当我单击选项卡时它会移动,但表格不会出现

http://smartdentalgroup.co.uk/test1/schedule_1.html http://smartdentalgroup.co.uk/test1/schedule_1.html

The only difference is in the jquery. 唯一的区别在于jquery。 Can somebody please, help me? 有人能帮帮我吗?

It's probably because you're using some deprecated or completely removed functions or features that is not compatible between two version. 可能是因为您使用的是两个版本之间不兼容的不推荐使用或已完全删除的功能。

One possible solution is to use jQuery migrate plugin which is used to detect and restore APIs or features that have been deprecated in jQuery and removed as of version 1.9 一种可能的解决方案是使用jQuery迁移插件,该插件用于检测和还原jQuery中已弃用并从1.9版开始删除的API或功能。

In your web page, load this plugin after the script for jQuery: 在您的网页中,在jQuery脚本之后加载此插件:

<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>

Firstly; 首先; If I were you I would be using the very latest version of jQuery (While your upgrading). 如果您是我,则将使用最新版本的jQuery(升级时)。 You are going to have to debug/make changes when upgrading anyway, might as well save yourself a bit of time later on and use the latest version. 无论如何,升级时都将不得不调试/进行更改,不妨在以后节省一些时间并使用最新版本。 Link is here. 链接在这里。 Use the 1.11.0 opposed to the 2.1.0 (As that version does not support some older browsers). 使用1.11.0而不是2.1.0 (因为该版本不支持某些较旧的浏览器)。

Now secondly, download Chrome (if you havn't already) go to your page and hit "Control + Shift + I". 现在,第二步,下载Chrome(如果尚未下载),转到页面并点击“ Control + Shift + I”。 This will open Chrome debugging tools; 这将打开Chrome调试工具; Which are fantastic. 哪个很棒。 You can see everything from the "real time" DOM layout to what errors are being through from the console. 您可以从控制台看到从“实时” DOM布局到正在经历的错误的所有信息。

You will be having these bugs because your code is using 'out-of-date' jQuery functions, this is a good way to start looking for them. 您将遇到这些错误,因为您的代码使用的是“过时的” jQuery函数,这是开始查找它们的好方法。

It may also be both looking at the jQuery 'upgrade plugin' as suggested, however I never had great luck with that. 它可能也都按照建议的方式查看jQuery“升级插件”,但是我从来没有碰到过运气。 In the end, I read through the patch notes and made changes manually. 最后,我通读了补丁说明并手动进行了更改。

Goodluck :) 祝好运 :)

Note: Just had a look through your page. 注意:只是浏览了您的页面。 Not sure if its a preference sort of thing, but I normally load my javaScript in the <HEAD> section of the HTML document. 不知道它是否是首选项,但是我通常将JavaScript加载到HTML文档的<HEAD>部分中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM