Reclaiming the $ for jQuery

Release 1.2 - ...

By default, the Smartsite iXperion Client Framework (Scf) uses $j to refer to jQuery. The reason for this has been to avoid conflicts with other libraries, such as Prototype, who use the same variable.

If you're sure that no conflicting library exists in your site, use the following statement immediately after the call to the Scf macro:

Smartsite SXML CopyCode image Copy Code
<se:scf startupmode="bodyscript" />
{placeholder.addjavascript('window.$=jQuery;')}

This way, all scripts referring to $j will keep working, but examples copied from the internet will also work.

Notes

The jQuery Documentation describes a number of ways in which to work with jQuery variables.

Behaviors and plugins added to the /Scf/jQuery/behavior/Classes and the /Scf/jQuery/Plugins/Aggregated folders will automatically be enclosed within a Module pattern and can use '$' internally. So do many jQuery plugins:

  CopyCode image Copy Code
(function( $ ){
 // code
})( jQuery );