google+javascriptbanktwitter@js_bankfacebook@jsbankrss@jsbank






Prototype jQuery et la résolution des conflits Cet article va vous expliquer comment résoudre le conflit entre jQuery et Prototype à la fois, afin d'utiliser les deux bibliothèques sur la même page Web.


Étiquette: Prototype, jQuery, conflit, résolution, Bibliothèque JavaScript, résoudre

Gratuit iPage hébergement Web pour la première année MOMENT



Si vous êtes toujours à la recherche d'un fournisseur d'hébergement Web fiable avec des tarifs abordables, pourquoi vous ne prenez pas un peu de temps pour essayer iPage, seulement avec $1.89/month, inclus $500+ Crédits supplémentaires gratuites pour le paiement de 24 mois ($45)?

Plus de 1.000.000 de clients + existisng peuvent pas avoir tort, vraiment vous n'êtes pas aussi! Plus important encore, lorsque vous enregistrez l'hébergement web à iPage grâce à notre lien, nous allons être heureux de renvoyer un plein remboursement. C'est génial! Vous devriez essayer iPage hébergement web GRATUITEMENT maintenant! Et contactez-nous pour tout ce que vous devez savoir sur iPage.
Essayez iPage GRATUIT première année MOMENT

I experienced this conflict quite recently when I was working on WordPress Featured Articles Plugin. Normally jQuery.noConflict() comes to the rescue but not in my case. And the reason being - prototype was already interacting and was included at the top, so it was already using the $ variable.

This conflict causes the creation of the jQuery object to fail.

 

All the following errors are related to this conflict and you might get one or all of the following while using Prototype (Scriptaculous) and jQuery -

jQuery is not defined

$ is not a function

$ is not defined $(document).ready(function(){

Component returned failure code: 0×80040111 JavaScript error

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMViewCSS.getComputedStyle]" nsresult: "0×80004005 (NS_ERROR_FAILURE)"

What can we do to fix this?

You can try moving the jQuery.js to top and than use jQuery.noConflict().

If that is not an option you can do the following -

IMPORTANT - Do not use [REPLACE ALL]

  • Edit prototype.js - find where it defines function $() and change the name to function $$$()
  • Still in prototype.js, carefully replace each occurrence of $(... ) with $$$(... ), but don't touch anything which says $$(... )
  • Edit each of the other *.js files (e.g. effects.js) and carefully replace each occurrence of $(... ) with $$$(... ), but don't touch anything which says $$(... ).
  • That is it.

And just in case you have trouble doing the above, Following links point to already edited prototype.js and effects.js. Please remember all the references to these files must start with $$$ instead of $.

Download - Prototype.js

Download - Effects.js

Hopefully this article will help some of our fellow coders and save them some time and frustration. Happy Coding guys :)

iPhoneKer.com
Save up to 630$ when buy new iPhone 15

GateIO.gomymobi.com
Free Airdrops to Claim, Share Up to $150,000 per Project

https://tooly.win
Open tool hub for free to use by any one for every one with hundreds of tools

chatGPTaz.com, chatGPT4.win, chatGPT2.fun, re-chatGPT.com
Talk to ChatGPT by your mother language

Dall-E-OpenAI.com
Generate creative images automatically with AI

AIVideo-App.com
Render creative video automatically with AI

JavaScript par jour


Google Safe Browsing McAfee SiteAdvisor Norton SafeWeb Dr.Web