Message Boards

Jquery 3.6.0 conflicts with Liferay 7 from theme

Kevin Neibarger, modified 2 Years ago.

Jquery 3.6.0 conflicts with Liferay 7 from theme

Regular Member Posts: 105 Join Date: 2/2/18 Recent Posts

Hello, I followed the blog below to include the newest version of jQuery (3.6.0). I just added a minified js file to my theme and included it in my portal_normal.ftl

https://liferay.dev/blogs/-/blogs/jquery-in-liferay-7-0

I did everything from the blog but when I try to load my intro page, I see multiple javascript errors in the console with Liferay specific jquery files


 

My portal_normal.ftl looks like this

<head>
    <title>${html_title}</title>

    <meta content="initial-scale=1.0, width=device-width" name="viewport" />

    <@liferay_util["include"] page=top_head_include />
    
    <script src="${javascript_folder}/jquery-3.6.0.min.js"></script>
     
    <script type="text/javascript">
        // handle the noconflict designation, use namespace dnjq for DN's jQ.
        dnjq = jQuery.noConflict(true);
    </script>
    
</head>

The Javascript errors don't go to a js file specifically and when I click on the link to see the source it goes to the Liferay generated HTML. What version of jQuery is Liferay using? When is it loaded? I am using Liferay 7.3 GA7. It was working fine with jQuery 1.11 but we want to upgrade due to security issues with that version.. It's blowing up because Liferay generated stuff is looking for $ and it's not loaded for some reason..