我们如何解决原型和jQuery之间的冲突?

Gau*_*shr 3 javascript jquery conflict prototypejs

要解决jQuery和prototype之间的冲突,
除了要求jQuery解析之外,还有什么方法

jQuery.noConflict

jQuery而不是$('code').code;

我们不能要求原型$下台并解决.

dec*_*eze 8

无论如何你应该命名代码,jQuery为你提供了一个很好的机会,可以$在同一步骤中重新声明:

jQuery.noConflict();

jQuery(function ($) {
    // $ is the jQuery object in here
    // and doesn't conflict with Prototype
});
Run Code Online (Sandbox Code Playgroud)

如上所述这里.

我不知道你是否可以让Prototype"降级",但这是一个非常优雅和有效的解决方案.