0

As described in docs.joomla.org (this page) ,to load jQuery library in normal mode (i.e. not in no-conflict mode) we should use this line of code:

JHtml::_('jquery.framework', false);

I used this code in my template, but it still loads jQuery in no-conflict mode.

<script type="text/javascript" src="/pilot/media/jui/js/jquery.min.js">
<script type="text/javascript" src="/pilot/media/jui/js/jquery-noconflict.js">
<script type="text/javascript" src="/pilot/media/jui/js/jquery-migrate.min.js">
<script type="text/javascript" src="/pilot/media/system/js/caption.js">
<script type="text/javascript" src="/pilot/media/jui/js/bootstrap.min.js">

Any idea what's happening?

1 Answers1

1

Basically if anything else calls jQuery in no-conflict mode - whether Joomla core for it's scripts or any third party extension then no conflict is loaded.

I've submitted a bug request to Joomla for it - but to be honest there's no reason why you shouldn't make sure you're scripts work in no conflict (especially as Joomla still loads mootools in places which screws up the $ alias - see Need help resolving what appears to be a jQuery/MooTools conflict for more info). Just wrap any jQuery code up with

(function($){

// Set a local $ variable only available in this block as an alias to jQuery
... Here is your jQuery specific code ...

})(jQuery);

and you're good to go!

Community
  • 1
  • 1
George Wilson
  • 5,595
  • 5
  • 29
  • 42