Expand my Community achievements bar.

SOLVED

Using 2 jQuery versions together

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

10 Replies

Avatar

Level 6

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

Avatar

Level 2

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

Avatar

Level 10

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! 

Avatar

Level 2

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

Avatar

Level 2

Hi Smac,

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

 

Regards,

Dimple

Avatar

Level 10

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

Avatar

Level 2

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

Avatar

Correct answer by
Level 10

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

Avatar

Level 2

Hi Sham,

Thanks for sharing the url.

 

 

Regards,

Dimple