How can I use JQuery on my site?

jQuery is a JavaScript library that is increasingly found in some Joomla! modules and templates. This is perfectly OK as long as jQuery is in no-conflict mode. If it isn't then it will probably cause a JavaScript conflict and break your form validation.

Note: Max has a fix for the ChronoForms code to make it compatible with jQuery. It will be included in ChronoForms from CFv4 RC3.6 when this is released. Meanwhile, please use the Contact Us form to ask Max for a patch.  

If this happens the problem is with the jQuery template or module, not with ChronoForms.

Out of the box jQuery isn't compatible with the MooTools library used by Joomla! and ChronoForms. You can use jQuery with MooTools in no-conflict mode. There are various ways of doing this. The simplest - which may or may not work - is  to add a line of script in the ChronoForms Form JavaScript box:

if (typeof jQuery != 'undefined' ) {
  jQuery.noConflict();
}

This will free the $ operator which is used by MooTools, so you may need to update your own JavaScripts to use the longer jQuery operator.

There is also a neat plugin named JB Library from Joomla! Bamboo and another named InterExt from AcuIT that allow you to control on which pages jQuery is loaded, and will always load it in no-conflict mode. However these requires that JQuery is loaded using the Joomla Document object methods. The InterExt extension allows you to select menu items to load JQuery.

I have a tutorial on {rokbox title=|Resolving jQuery problems| size=|800 600| text=|Resolving jQuery problems|}http://greyhead.net/how-to-docs/cfv4-resolving-jquery-problems{/rokbox} that explores some of the issues an diagnostics and shows how to modify one template example to use the Joomla! Document methods to load JQuery in noConflict mode.

Category: CFv4 Validation

Comments:

You need to login to be able to post a comment.