Last Updated:
September 20, 2021
by
Muskan Purohit
| Version: 2
| 1,538 views
| 0 followers
members are following updates on this item.
jQuery is loaded and available out of the box on all Igloo pages.
jQuery can be used anywhere on an Igloo in the following ways:
/**
* @description "Quick & Dirty" methods to use jQuery
*/
jQuery('#element');
/**
* @description If more than one line is required use a variable
*/
var $j = jQuery.noConflict();
$(document).ready(function () {
var el = $j('#element');
});
The typical JavaScript framework alias ($) is bound to mooTools on the Igloo platform, therefore the best way to write a jQuery-based web application is to wrap your code in the following IIFE where applicable:
/**
* @namespace
* @description Basic JavaScript IIFE that sets the $ identifier alias to 'jQuery'
*/
(function ($) {
// My custom Igloo jQuery application
$(document).ready(function () {
console.log(greeting);
});
})(jQuery);
The current version of jQuery implemented on the Igloo platform is 1.11.0
/**
* @description Print the current version of jQuery to the console
*/
if (typeof jQuery != 'undefined') {
console.log(jQuery.fn.jquery);
}