Skip to main content
9 votes

Pass var to jQuery script

After this question was originally answered, Joomla introduced in version 3.5 another way of passing variables to javascript, using the addScriptOptions() method of the Joomla Document class. So I'm ...
Robbie Jackson's user avatar
8 votes
Accepted

Is it possible to load a newer jQuery version?

Or does Joomla really need the 1.x version? Joomla itself may work mostly fine with newer jQuery versions. The reason it ships with such an old version is compatibility for 3rd party extensions. So ...
Sharky's user avatar
  • 11.3k
8 votes

Loading the built-in jQuery in Joomla 4 if it does not exist

You should be able to load it like so: Joomla\CMS\HTML\HTMLHelper::_('jquery.framework'); Else, if you're using Joomla's Web Asset Manager, then you can define it as a dependency in your JSON object: ...
Lodder's user avatar
  • 26.9k
5 votes
Accepted

Loading the built-in jQuery in Joomla 4 if it does not exist

Lodder answer is certainly useful, but not what I wanted to see. The correct loading of the embedded jquery looks like this. use Joomla\CMS\Factory; $wa = Factory::getApplication()->getDocument()-&...
MaXX's user avatar
  • 181
4 votes

Joomla 3.4.1 how to delete JCaption, called with jQuery?

A better solution for disabling JCaption injection in content pages is to override Joomla's core 'behavior.caption' HTML behavior with a stub function. You achieve this by creating a simple system ...
John Rix's user avatar
  • 551
4 votes

jQuery scripts not working in Joomla 4 template

Yes, for the most part J4 uses vanilla JavaScript and dependencies like jQuery should be loaded only when needed. If it's needed by your template's script files, you can add it as dependency in your ...
Sharky's user avatar
  • 11.3k
3 votes
Accepted

XML form related fields

Have you tried to use Subform field?. It allows you to nest XML forms inside each other or reuse your existing forms inside your current form. And your need, you can combine it with showon attribute.
webchun's user avatar
  • 2,418
3 votes

AJAX post not able to update database

After more searches, I managed to work it out. Hopefully the below will offer some small mercy to some lost joomla soul like I was. The main challenge was constructing the URL and get a response. So ...
Phillip's user avatar
  • 61
3 votes
Accepted

Optimize Joomla SQL Query to store data in array and pass on array output to field

There's no need for multiple queries in your case. You can simply select email and mobile from the table, like so: $id = JFactory::getApplication()->input->getInt('vid', ''); $db = JFactory::...
Lodder's user avatar
  • 26.9k
3 votes
Accepted

jquery.minicolors.js with opacity

As said in comment, I would extend JFormFieldColor and override getInput method. As it turned out, Joomla! current jQuery minicolor plugin is outdated, so you should include your own. There is PR for ...
Rene Korss's user avatar
  • 3,208
3 votes

How to add module's JavaScript in the header when in Javascript code used php variable

Assuming you are asking how to combine PHP and JavaScript, one way would be to add the JavaScript inline via your module's PHP using this method, which will add it to the head of the page when the ...
RichardB's user avatar
  • 3,082
3 votes
Accepted

Scroll text within a div in a module

My guess would be that you are calling the javascript before the html. Try wrapping it in jQuery( document ).ready so that it loads after the html, ie jQuery( document ).ready(function() { var ...
RichardB's user avatar
  • 3,082
3 votes
Accepted

iFrame with javascript

Firstly, your Javascript contains an error so it won't run at all. Specifically you're missing a ) near the end. Secondly, Google send a X-Frame-Options: SAMEORIGIN header, basically meaning you ...
Lodder's user avatar
  • 26.9k
3 votes

Link to Page & Pre-Filter Portfolio Items

By "anchor and jquery" you mean like the way bootstrap tabs work - ie. by letting the uri's fragment hit the id of the tab. But these tabs aren't set up like that. You can of course use jquery to ...
jamesgarrett's user avatar
  • 3,299
3 votes
Accepted

Link to Page & Pre-Filter Portfolio Items

I found the answer, thanks for the help @jamesgarrett The tabs were using shuffle.js so I needed to edit the page builder js file. jQuery(function($) { var $container = $('.sp-simpleportfolio-...
jonboy's user avatar
  • 3,603
3 votes

Legacy component + jquery + SEO = 404

I needed a / in front of the jquery url: /index.php?option=com_todomanager&task=save&format=raw Otherwise the url would get prepended with a menu item path, which was causing the 404 tasks/...
Jimmy's user avatar
  • 327
2 votes

How to trigger javascript on a date selection on JHTML::_calendar

This is supported directly in core Joomla, at lease in version 3.8.5. JHTML::calendar takes five parameters, the value (date time), element name, element id, date time format and attributes. The ...
Dom's user avatar
  • 512
2 votes
Accepted

How to make it easier for a client to update Joomla website?

Welcome to Joomla!! There are two main ways of creating complex layouts in Joomla!: Create templates with multiple/varying module positions and assign content blocks to those positions as needed. ...
Michael Yaeger's user avatar
2 votes

Show Form Field if AJAX-response is false

Well you could attach your hide/show functions within the success parameter of the ajax method. var showMethod = function () { // show method code... } var hideMethod = function () { // hide ...
FFrewin's user avatar
  • 19.7k
2 votes
Accepted

jquery mini slider, generate unique id

This is because both sliders are using the same classes. I'd suggest that on hover, you find the outer parent first, then target the image, like so: jQuery(document).ready(function($){ var ...
Lodder's user avatar
  • 26.9k
2 votes

AJAX test module is not working. POST 404 error

Found the problem by myself. 'module' : 'mod_ajax_test', must be 'module' : 'ajax_test',
Striker8472's user avatar
2 votes

best way to add third party js and css

Personally, I'd much rather deliver CSS and JS files via a CDN than using something like JCH optimise to combine them all into 1 file. With HTTP/2, files are delivered much quicker, so a couple more ...
Lodder's user avatar
  • 26.9k
2 votes
Accepted

custom table display - help turning static html to dynamic php

The jQuery function was operating against all elements with the assigned target class. The result of that was all dropdowns opening simultaneously. The resolution was to assign a unique ID to each of ...
Terry Carter's user avatar
  • 1,812
2 votes
Accepted

Active menu items on page scroll with fullpage.js

You need to override the output of your menu module. Assuming you are using the Joomla core mod_menu, then: Copy the default.php from modules/mod_menu/tmpl/ Paste it to templates/YOUR_TEMPLATE/html/...
FFrewin's user avatar
  • 19.7k
2 votes
Accepted

Some js files have temporary string at the end

The strings are added by Joomla: method_addScriptVersion. You may find this plugin usefull to remove scribts etc.: kubik-rubik, jcc-js-css-control
CE WebDesign München's user avatar
2 votes

Populate Joomla Calendar field by jQuery not working

I noticed a change in the calendar widget in Joomla 3.8. In addition to the setting the value via val(), I also had to set the data-alt-value attribute as well. Otherwise it would fail validation. So, ...
Dan Cogliano's user avatar
2 votes
Accepted

Setting a Start/End time to J2store Date picker field

After ordering a nice appetizer for $6.10 on the site :) I was able to check the datetime picker on the page. This datetime picker is built in your_joomla/administrator/components/com_j2store/helpers/...
Zollie's user avatar
  • 2,936
2 votes
Accepted

Update List field rendering after ajax update

If you're using ChosenJS, which is the fancy select library that Joomla 3.x uses, then you'll need to manually instruct it to update the list, because it doesn't use any observers by default. You can ...
Lodder's user avatar
  • 26.9k
2 votes
Accepted

Joomla trigger event when element in field of “filelist” type is selected

Put the event listener on the underlying hidden select field not on the chozen ui element. The id of the select will be the same id without the _chzn suffix. jQuery(document).ready(function(){ ...
jamesgarrett's user avatar
  • 3,299
2 votes

Activate jquery with javascript

Let Joomla handle it. In the main module you can add, for Joomla <= 3.9: JHtml::_('jquery.framework'); or for Joomla 3.10 and 4+, add this at the very start of the file: defined('_JEXEC') or die; ...
Riccardo Zorn's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible