Using 2 jQuery versions together | Community
Skip to main content
dimple_gawri
Level 2
October 16, 2015
Solved

Using 2 jQuery versions together

  • October 16, 2015
  • 10 replies
  • 3023 views

Hi All,

My project need to use both the jQuery versions(1.9.1 & 1.8.1). Can anybody guide me how to use my custom js 1.9.1 without conflicting with AEM 5.6.1 built-in js 1.8.1

Thanks,
Dimple

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

Dimple Gawri wrote...

Thanks for sharing the url. If possible, can u also share me the url regrading using Teaser component & need for teaser component.

 

 

 

http://docs.adobe.com/docs/en/aem/6-0/author/personalization/campaigns/teasers-and-strategies.html  With latest aem I would recommend to go with targetting. http://dev.day.com/docs/en/cq/current/wcm/content-targeting.html

10 replies

Sham_HC
Level 10
October 16, 2015
Level 6
October 16, 2015

In publish mode, that is not a problem. You choose what libraries you want to include. In author modes, that is a bit trickier. What you have to do is use the jquery.noConflict() function and declare multiple $ instances. That is described in http://forum.jquery.com/topic/multiple-versions-of-jquery-on-the-same-page (LMGTFY) and some more explanation on http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/

 

/Ove

dimple_gawri
Level 2
October 16, 2015

Hi Ove,

Thanks for the response. I tried to use the approach referred by you. But still no success.

In my project, head.jsp is loading jQuery 1.9.1 and body.jsp is referring to adobe cq clientcontext component, which is by default referring to jquery 1.8.1

Moment, my page loads jquery version 1.9.1, adbe cq clientcontext component stops working.

Could you please suggest any other alternative how to resolve this?

 

Thanks,

Dimple

smacdonald2008
Level 10
October 16, 2015

This is more of a JQuery issue as opposed to an AEM issue. See this stackoverflow thread:

http://stackoverflow.com/questions/4844347/use-two-jquery-version-in-one-page

Hope this helps you! 

dimple_gawri
Level 2
October 16, 2015

Hi Smac,

Thanks for the response.

Actually what issue now I am facing once Adobe CQ granite jQuery got loaded, then my custom jquery version 1.9.1 stop working.

Since Adobe CQ  granite jQuery is referring to jQuery 1.8.1.

I tried to use the jQuery.noConflict also. But still no success.

Can it be possible if I can update CQ granite jQuery to version 1.9.1 or remove the reference of granite jQuery js

Also, since I am a beginner for Adobe CQ, can you please provide me some url which can guide me what is the role of granite.

Looking forward to your reply.

 

 

Thanks,

Dimple

dimple_gawri
Level 2
October 16, 2015

Hi Smac,

Yes you were right. This was a jQuery issue only. Thanks for your help.

 

Regards,

Dimple

Sham_HC
Level 10
October 16, 2015

Dimple Gawri wrote...

Also, since I am a beginner for Adobe CQ, can you please provide me some url which can guide me what is the role of granite.

http://dev.day.com/docs/en/cq/current/touch-ui/touch-ui-concepts.html#Granite

dimple_gawri
Level 2
October 16, 2015

Hi Sham,

Thanks for sharing the url. If possible, can u also share me the url regrading using Teaser component & need for teaser component.

 

 

Regards,

Dimple

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

Dimple Gawri wrote...

Thanks for sharing the url. If possible, can u also share me the url regrading using Teaser component & need for teaser component.

 

 

 

http://docs.adobe.com/docs/en/aem/6-0/author/personalization/campaigns/teasers-and-strategies.html  With latest aem I would recommend to go with targetting. http://dev.day.com/docs/en/cq/current/wcm/content-targeting.html

dimple_gawri
Level 2
October 16, 2015

Hi Sham,

Thanks for sharing the url.

 

 

Regards,

Dimple