Joomla 3 - How to override jQuery with newer version?
Asked Answered
D

3

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?

Dornick answered 25/9, 2013 at 8:4 Comment(0)
D
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.

Dornick answered 25/9, 2013 at 8:4 Comment(3)
JHtml::_('jquery.framework'); imports jQuery from media/jui/js, not the template folder.Supposed
Yes, BUT if you follow the instructions above, it will load the one under templates, if you put one there.Dornick
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.Potoroo
R
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

Rondi answered 26/9, 2013 at 3:35 Comment(0)
S
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

Supposed answered 25/9, 2013 at 10:21 Comment(4)
Not such a great idea. An later update may override them with another unwanted version.Dornick
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 ;)Supposed
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.Dornick
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 updatedSupposed

© 2022 - 2024 — McMap. All rights reserved.