Greetings When loading a site on Joomla3 there is such a line (if you look at the source code, through a browser)

<script src="/media/jui/js/jquery.min.js" type="text/javascript"></script> 

which essentially connects jQuery v1.11.3, but the scripts that I write in the template do not work.

If I add to the template

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" type="text/javascript" ></script> 

That scripts work. I checked these 2 files from Google and from the media folder they are the same.

What could be the reason?

SOLVED There really is jQuery.noConflict ();

 <script src="/media/jui/js/jquery-noconflict.js" type="text/javascript"></script> 

Replaced in the script

 $(document).ready(function(){ 

on

 jQuery(document).ready(function($) { 
  • 3
    Is the first file loaded? Does it load up to the scripts that you write in the template? "Do not work" - are there any errors in the console? - Roman Paradeev
  • Without a description of the errors in the browser console or a link to the site, it is useless to guess. - Andrew Hobbit
  • In the console, is it like "developer tools" or firebug? There are no mistakes - Mikhail Sosnin

2 answers 2

I will assume that jQuery.noConflict() or jQuery.noConflict(true) is called jQuery.noConflict() .

https://api.jquery.com/jquery.noconflict/

  • The correct assumption) then goes it turns out 4 more libraries. media / jui / js / jquery-migrate.min.js + media / system / js / caption.js + modules / mod_vm_cart / assets / js / update_cart.js + /media/jui/js/bootstrap.min.js - Michael Sosnin

Write scripts like this will work

 (($)=>{ тут код })(jQuery) 

So you can still

 (($) => { $(document).ready(function(){ alert('Hello world'); }); })(jQuery); 

http://codepen.io/korolariya/pen/jqjrLb

Don't write like that

 <script> var test = 1; </script> 
  • This is what I understand in some editor to turn into jQuery (document) .ready (function ($) {code here}? - Mikhail Sosnin
  • no, this is normal code, standard scope wrap - Serge Esmanovich