8
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 ...
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 ...
7
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:
...
6
votes
External Jquery Script not working
You are probably running into conflict problems, since both jQuery and the mootools library use the '$' char as shortcut.
There are multiple ways to deal with that problem. You have to find out ...
5
votes
Joomla 3.4.1 how to delete JCaption, called with jQuery?
This is a very old question and probably nobody reads it anymore, but anyways I will post my answer.
In the regex for the JQuery caption you have errors. You don't need to escape dots but you have to ...
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 ...
4
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()-&...
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 ...
3
votes
Accepted
How to call jQuery in joomla on specific script
If you want to use the $ - sign inside your jQuery function, you have to call it like this:
jQuery(function($) {
$.contextMenu({ ...
(Note the $ inside of function())
$ is just a shortcut often ...
3
votes
Accepted
Post data using com_ajax joomla 3
I am not sure about $input->get('data', '', 'array'). Are you sure that data var is being passed?
I think you can simply use $input->getString('username') and so on to retrieve parts of the ...
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 ...
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 ...
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::...
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 ...
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.
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 ...
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 ...
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 ...
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-...
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/...
2
votes
Return to previous page menu item
I don't know of any extension that does this for you, but you can use Javascripts history.go(-1) feature which will do the same as clicking the "back" button on your browser.
To add a menu menu item, ...
2
votes
Accepted
Scroll to a section or module
Your selector jQuery('#t3-banner') is wrong. This should be selector for your <a>, which has attribute href="#t3-banner".
It would work with this:
jQuery(document).ready(function($){
var $...
2
votes
JavaScript file not loading before dom
I just found a solution. I used
jQuery( document ).ready(function( $ ) {
// Code goes here
});
I think jQuery.noConflict(); was being fired in another script.
2
votes
Change color on element more than one time
I'm not understanding the last anchor part, but to get it back to white after scrolling to next point, you have to compare against element bottom position too. And if not true, revert to white.
...
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 ...
2
votes
How to retrieve the CHANGED text from Joomla Editor?
The question by "GDP" was
"How does one get to the edited text that the user wants to save, in order to be posted?.
"elk" got me started on the right path but I resorted to jQuery to actually get ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
jquery × 175joomla-3.x × 79
javascript × 47
ajax × 26
php × 25
module × 13
joomla-2.5 × 13
component × 8
development × 8
bootstrap × 8
joomla-3.4 × 6
custom-component × 6
joomla-4.x × 6
plugin × 5
virtuemart × 5
templates × 4
joomla-3.3.x × 4
jform × 4
fix-my-code × 4
rsform × 4
mysql × 3
css × 3
form × 3
form-fields-types × 3
jhtml × 3