Hot answers tagged

15 votes
Accepted

Jhtml::script order - how to postpone until jQuery has been loaded?

You should call JHtml::_('jquery.framework'); before your other JHtml::script. AFAIK this makes sure that jQuery is loaded first.
user avatar
  • 3,693
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 ...
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 ...
user avatar
  • 8,222
7 votes
Accepted

Compressing Site prior to completion

You should maintain the uncompressed version for development. Use any tool to compress the javascript files automatically. if Joomla debug mode is true, include un-compressed files, else include ...
user avatar
  • 1,291
6 votes
Accepted

Return JSON using the Joomla Framework

I finally found what seems to be the "correct" way to do this. Even if I used sendHeaders, the additional Content-Type was being added and that got returned as it was added later. I followed through ...
user avatar
  • 541
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 ...
user avatar
  • 3,693
6 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: ...
user avatar
  • 26.4k
5 votes
Accepted

Mootools-more.js conflicting with Bootstrap Button dropdowns

This is the only workaround I've found so far (opened for review): // MooTools window.addEvent('domready',function() { Element.prototype.hide = function() { alert('Intercepted'); ...
user avatar
5 votes
Accepted

How to best include jQuery Themeroller in an extension?

to include specific JS and CSS in a component, I follow Michael Babker's advice: Use the media Folder, Allow Overridable Media http://www.babdev.com/blog/139-use-the-media-folder-allow-overridable-...
user avatar
  • 332
5 votes

Google Map not loading properly inside Bootstrap tab

First the reason re sizing fixes it is that the map checks that everything is "correct" on browser resize. Since the tab is hidden by default the size of the map is smaller until the tab is opened, ...
user avatar
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 ...
user avatar
  • 151
4 votes

Return JSON using the Joomla Framework

Took a little digging but I see the issue https://github.com/joomla-framework/application/blob/master/src/AbstractWebApplication.php If you look at the setHeader function it does not actually set ...
user avatar
4 votes

Chart library for backend

Google Charts is plain simple, and you don't add Kbytes to your download. I've implemented Google Charts to fill chart requirements. jqPlot library (and similar libraries) provides a better feature ...
user avatar
  • 7,415
4 votes
Accepted

How is jQuery added to Joomla Template Protostar

jQuery automatically gets imported in noConflict mode when you use the following code: JHtml::_('bootstrap.framework'); which also as you can probably figure out, loads the Bootstrap framework too. ...
user avatar
  • 26.4k
4 votes
Accepted

How to add jQuery functionality in the backend of a module?

You will need to create a custom form field for this. So firstly, change the type of the field in your XML like so: <field name="brands" type="brands" label="Foreign Brands" /> Then in your ...
user avatar
  • 26.4k
4 votes

Backend module does not run jQuery / JavaScript script?

Your code has several errors, here's a couple: js.js You can't load scripts using <script> inside a .js file You shouldn't need to load jQuery at all, it's included in Joomla (and it's usually ...
user avatar
  • 13.3k
4 votes
Accepted

Adding ajax in Joomla Custom Module

Well in case you don't want to use Joomla Ajax Interface, you could also do it like this: You have a module and you have your component. The script code goes into a javascript file or the view of the ...
user avatar
  • 346
4 votes

Joomla 3.4.1 how to delete JCaption, called with jQuery?

Try this: $this->_scripts = array(); unset($this->_script['text/javascript']);
user avatar
  • 1,282
4 votes

Click login button programmatically

You need to trigger submit on form for login user. edit: did not see You don't have a login id in your div. so try this: jQuery('.loginbtn').trigger('click'); and if this not work for you try this: ...
user avatar
  • 522
4 votes
Accepted

Pass var to jQuery script

Javascript have global variables : http://www.w3schools.com/js/js_scope.asp inside you php file you call: JFactory::getDocument(); and you can now add some javascript at the current page with ...
user avatar
3 votes

How to load Joomla session from external AJAX call

To load the session you need to get it from JFactory. $session = JFactory::getSession(); Read more on How to access session variables set by an external script.
user avatar
3 votes
Accepted

How to retrieve the CHANGED text from Joomla Editor?

If I remember it right, JCE uses an iframe for the content. Thus, you need to get a reference to the iframe first, then access the inner document of the iframe, which will provide the innerHTML as the ...
user avatar
  • 346
3 votes
Accepted

Make submit button inactive until fields have been filled

I suggest you start with disabling the submit button using jQuery(to avoid disabled buttons for non-javascript users): jQuery("#Submit").prop('disabled', true); Then use this code to enable the ...
user avatar
  • 13.3k
3 votes
Accepted

Joomla! 3.3.6 - JQuery validation plugin using remote method

You need to add &format=raw at the end of the URL so it will look like the following: index.php?option=com_component&task=checkDomain&tmpl=component&format=raw Hope this helps
user avatar
  • 26.4k
3 votes

RokSprocket automate Load More

I've never used RokSprocket before but I hope this answer will help you. Lets say you have the following HTML markup for your button: <div class="loadmore">Load more</div> Now rather ...
user avatar
  • 26.4k
3 votes
Accepted

JHtml Tabs have no IDs - how can I specify them?

Just use an attribute selector. You can target the href attribute in css with [href="#tabs_1a"] for example. I have no experience with jQuery, but the example in GDPs answer uses attribute selectors ...
user avatar
  • 1,196
3 votes

Adding ajax in Joomla Custom Module

I think the best option here is to use Joomla Ajax Interface A slim, extensible component to act as an entry point for HTTP requests for stand alone modules and plugins, thus allowing for the ...
user avatar
  • 4,045
3 votes
Accepted

Joomla list form field change values on runtime

If you are using "Chosen" for your selects then you should trigger "Chosen" to update the data: jQuery("#jform_state").append("<option value=Bavaria>Bavaria</option>"); jQuery("#...
user avatar
  • 4,045
3 votes
Accepted

JQMIGRATE: Logging is active - how to disable

I had the exact same thing a couple of days ago when testing some avatars in our extension. The message you've provided is being produced by Community Builder as it's importing jQuery Migrate (...
user avatar
  • 26.4k
3 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 ...
user avatar
  • 527

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