Javascript库+ JQuery插件矛盾吗?如何调试? [英] Javascript libraries + JQuery plugins contradict? How to debug?

查看:117
本文介绍了Javascript库+ JQuery插件矛盾吗?如何调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个新手问题...我每天都在努力学习,所以请谅解;) 我不是最好的专家,但是我可以做得不错,外观和功能良好的网站或Web应用程序.我的主要工具是PHP5,HTML5,CSS2和3,数据库(SQLite,MySQL)以及Javascript和JQuery.

This is somewhat a newbie question... I effort everyday to learn, so please understand ;) I'm not the very best expert, but I can do a decent job good looking and functional websites or web applications. My main tools are PHP5, HTML5, CSS2 y 3, a database (SQLite, MySQL) and Javascript and JQuery.

我根本不是Java方面的专家.我经常找到有趣的JQuery插件或教程,并尝试将它们混合在一起以完成所需的功能.这次,我可能混合了太多来自不同来源的插件和js文件.

I'm not an expert at all in Javascript. I often find interesting JQuery plugins or tutorials and try to mix them up to do the functionality needed. This time I'm mixing maybe too much plugins and js files from different sources.

实际上,我的应用程序可以执行我想要的操作,但某些行为除外……没有错误,一切看起来都很好,但是异常行为仍然存在.因此,也许我需要指定一个我不知道的类,或者一个与另一个插件的另一个类矛盾,而我却无法理解,例如,为什么<button type="button">DON'T submit</button>只提交表单...

In fact, my app do what I want except for certain behaviors... There are no errors, everything looks fine, but the misbehavior persists. So maybe I need to specify a class I don't know about, or one contradicts another one from another plugin and I just can't understand, for example, why a <button type="button">DON'T submit</button> just submits the form...

无论如何,我的意思是:人们知道一种调试这种情况的方法吗???有没有通用的工具,建议,工作流或其他工具可以帮助我了解库或插件之间的冲突或遗漏??? (JavaScript库,我自己的Javascript和JQuery插件)???

Anyway, my point is: Do you people know a way to debug this situations??? Is there a generic tool, suggestion, workflow or something to help me understand conflicts or omissions between libraries or plugins??? (Javascript libraries, my own Javascripts and JQuery plugins)???

我了解Chrome调试器和FireBug ...但是也许我只是不知道如何获得所需的功能...有关如何使用这些工具的信息还没有帮助了我……例如:我有一个标签,该标签继承了一个我没有手动分配给它的类(例如:<button type="button" disabled>DON'T submit</button>我没有自己写成禁用的),所以它分配了一些Javascript文件,但我对世卫组织的看法有多不满意?会文件吗?班级?插入?图书馆? ETC?那是我要问的另一个例子=)

I know about Chromes debugger and FireBug... But maybe I just don't know how to get the functionality I need... Reading about how to use these tools haven't helped me... For example: I've got a tag which has inherit a class I didn't assigned it to by hand (example: <button type="button" disabled>DON'T submit</button> I didn't write disabled by myself) So some Javascript file it's assigning it, but how con I see WHO did this? Wich file? Class? Plugin? Library? Etc? That's another example of what I mean to ask =)

我希望这是一种方法!感谢您的帮助和理解! =)

I hope it is a way! THANKS A LOT FOR YOUR HELP AND COMPREHENSION! =)

推荐答案

您可能正在使用两个使用$()函数的库.在jQuery中,$()函数只是jQuery()的简写,因此您可以尝试获取jQuery代码,然后将每个"$("实例替换为"jQuery("),看看是否有帮助.正在使用,我无法确定这是否行得通,但是如果您一次加载了多个框架(例如jQuery),则可能是问题所在.

It is possible that you're using two libraries that use the $() function. In jQuery, the $() function is just shorthand for jQuery(), so you could try taking your jQuery code and replacing every instance of "$(" with "jQuery(" and see if that helps out. Without know what scripts you're using I can't tell if that will work or not, but this is likely the problem if you have more than one framework (e.g. jQuery) loaded at one time.

请确保不要将任何非jQuery函数从$()更改为jQuery(),否则它们会中断.

Just make sure you don't change any non-jQuery functions from $() to jQuery() or else they'll break.

这篇关于Javascript库+ JQuery插件矛盾吗?如何调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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