1 Reply Latest reply on Mar 3, 2008 11:14 AM by Florent Dupont

    use of jQuery plugins

    Florent Dupont Newbie

      I'm trying to use jQuery plugins with my app.
      Actually I'd like to use the masked input to allow my users to type only a given date format.

      So, I included my JS files :

      <script type="text/javascript" src="../common/script/jquery.maskedinput.js"></script>


      and declared my fields of class 'date' to be masked with the '99/99/9999' mask:

      <rich:jQuery selector=".date" query="mask('99/99/9999')" />


      But i got the following JS errors once I run the app :

      $.fn has no properties
      (no name)(function())jquery.maskedinpu... (line 32)
      [Break on this error] $.fn.caret=function(begin,end){


      and

      jQuery(selector).mask is not a function
      [Break on this error] try {


      It looks like plugins are not compatible with the rich:jQuery tag.
      Is <rich:jQuery> useable with plugins ? Does anyone have some examples with jQuery plugins ?

        • 1. Re: use of jQuery plugins
          Florent Dupont Newbie

          I finally found out a solution by taking a look at the jQuery JS file. The generated file is not the exact jQuery library file but a modified one, meaning that the jQuery object is not the one I was expecting to work with.

          If I want to access to the object jQuery, I actually have to use the 'oldJQuery' object.

          So I changed in my plugin file the following (jquery.maskedinput.js):

          (function($) {<< your plugin code here>>})(jQuery);

          to
          (function($) {<< your plugin code here>>})(oldJQuery);


          and it's now working nicely.

          You can do the same with all your plugins to make them work mith RichFaces and the <rich:jQuery> tag.