Use Newer JQuery Version with RichFaces

Use Newer JQuery Version with RichFaces

JQuery with RichFaces


24 June 2016

RichFaces 3.3 comes with older version of JQuery. If you want to use a fancy plugin that requires a newer version of JQuery, you are stuck. Right? Well, not really :).

We have been using newer versions of JQuery with RichFaces without breaking any inbuilt functionality of RichFaces.
First lets store the reference of the JQuery of RichFaces in a variable named $rfjquery :

<script type="text/javascript">
    var $rfjquery  = jQuery.noConflict(); 

Having done that, time to include newer version of the JQuery

<script type="text/javascript" 
<script type="text/javascript">
    newjq =  jQuery.noConflict();
    // All the plugin code goes here. Use newjq instead of $ or jQuery

Once you are done with all the changes of the plugin and used all the fancy features of the newer version of JQuery, time to revert to the original version of RichFace’s JQuery so that we do not break anything.

<script type="text/javascript"> var jQuery = $rfjquery; </script>

That’s it. If you have any problem, leave a comment.

Blog Categories
Request a quote