Difference between revisions of "JQuery and Bex"
From All n One's bxp software Wixi
(JQuery and Bex) |
|||
| Line 2: | Line 2: | ||
To use JQuery within bxp we need to modify the jQuery identifier, we need to do this as bxp uses the Prototype library. The Prototype Library uses the $ identifier just like JQuery and because the Prototype library is referenced before the jQuery. Jquery allow you to modify the $ identifier to be a custom one, inorder to avoid any issues with jQuery | To use JQuery within bxp we need to modify the jQuery identifier, we need to do this as bxp uses the Prototype library. The Prototype Library uses the $ identifier just like JQuery and because the Prototype library is referenced before the jQuery. Jquery allow you to modify the $ identifier to be a custom one, inorder to avoid any issues with jQuery | ||
| + | |||
| + | |||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
var $JQ = jQuery.noConflict(); // This line is required to make jQuery Play nice with bxp | var $JQ = jQuery.noConflict(); // This line is required to make jQuery Play nice with bxp | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| + | |||
The above line must be the first line in your custom JavaScript code in order for it to work. When referencing a Jquery function you should use the custom identifier $JQ instead of $ | The above line must be the first line in your custom JavaScript code in order for it to work. When referencing a Jquery function you should use the custom identifier $JQ instead of $ | ||
| + | |||
| + | |||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
Revision as of 10:13, 5 November 2014
Overview
To use JQuery within bxp we need to modify the jQuery identifier, we need to do this as bxp uses the Prototype library. The Prototype Library uses the $ identifier just like JQuery and because the Prototype library is referenced before the jQuery. Jquery allow you to modify the $ identifier to be a custom one, inorder to avoid any issues with jQuery
var $JQ = jQuery.noConflict(); // This line is required to make jQuery Play nice with bxp
The above line must be the first line in your custom JavaScript code in order for it to work. When referencing a Jquery function you should use the custom identifier $JQ instead of $
$JQ( "#strCDA_X_field_X_X" ).datepicker({
numberOfMonths: 1,
changeYear: true,
dateFormat: 'yy-mm-dd',
showButtonPanel: true
});