6

In Joomla 3.x jQuery is coming by default with Joomla, but the version is a bit outdated (v.1.8.3) and I have a script that needs a newer version.

What can I do?

Charles
  • 50,943
  • 13
  • 104
  • 142
Valentin Despa
  • 40,712
  • 18
  • 80
  • 106

3 Answers3

14

In your template you can also override the jQuery file.

Like this:

JOOMLA_ROOT/templates/YOURTEMPLATE/js/jui/jquery.min.js

Where jquery.min.js is a newer version of jQuery.

That way Joomla will load your file and not the default version when using JHtml::_('jquery.framework');

Caution: Test well, so that you don't have other issues with the newer jQuery version.

Credits: Thanks Michael.

Community
  • 1
  • 1
Valentin Despa
  • 40,712
  • 18
  • 80
  • 106
  • `JHtml::_('jquery.framework');` imports jQuery from `media/jui/js`, not the template folder. – Lodder Sep 25 '13 at 10:24
  • Yes, BUT if you follow the instructions above, it will load the one under templates, if you put one there. – Valentin Despa Sep 25 '13 at 10:48
  • 1
    Just wanted to add that it works also for overriding Bootstrap. Just add your new bootstrap.min.js inside JOOMLA_ROOT/templates/YOURTEMPLATE/js/jui/ and bootstrap.min.css inside JOOMLA_ROOT/templates/YOURTEMPLATE/css/jui/ and you're done. – Isidro Baquero Dec 10 '14 at 17:49
1

If you are not satisfied with the @Lodder's method you could try this below. I think it caters your requirement. You are able to control your jQuery & jQuery UI versions.

http://extensions.joomla.org/extensions/core-enhancements/performance/jquery-scripts/18327

Techie
  • 44,706
  • 42
  • 157
  • 243
0

With Joomla 3.x, the jquery.js and jquery.min.js files are located in:

JOOMLA_ROOT/media/jui/js/

Download jquery.js v1.10.2 (uncompressed)

Download jquery.min.js v1.10.2 (compressed)

Simply download both, rename them so that they have the same file names, then upload to the location provided above.

Hope this helps

Lodder
  • 19,758
  • 10
  • 59
  • 100
  • Not such a great idea. An later update may override them with another unwanted version. – Valentin Despa Sep 25 '13 at 10:49
  • such as? Assuming the OP is running Joomla 3.1.5 (which they should be), the next update will be 3.2, which uses jquery 1.10.2....so any overrides will be ok ;) – Lodder Sep 25 '13 at 11:06
  • I was just pointing out that they may be replaced (without the user noticing this or having a way to control this). Yes, in this case jQuery will be `1.10.2` in 3.2. But this is why overrides exist: not to get surprised by a update. – Valentin Despa Sep 25 '13 at 11:15
  • Yup, I full agree with you about overrides and why they are used. I hate it when people say they have been editing core files etc lol. The only reason why I suggested my answer specifically because the next jquery version in the next Joomla update will be 1.10.2 and therefore wouldn't be an issue if anything was overridden. The only problem with adding jquery.js to your template folder is that it WILL be removed if the template is updated – Lodder Sep 25 '13 at 11:24