3 Replies Latest reply on Nov 25, 2008 10:28 AM by vladimir.kovalyuk

    a4j:loadScript and rich:jquery

    nimo22

      I have a few questions about using jquery with prototype in richfaces:

      Question A:
      Which way should I use, to insert the jquery-script?

      This way?
      <a4j:loadScript src="resource:///org/richfaces/renderkit/html/scripts/jquery/jquery.js" />

      or that way?
      http://docs.jquery.com/Using_jQuery_with_Other_Libraries

      Question B:
      When I use the way with a4j:loadScript, what about the $? Can I use $ for both, prototype and jquery? Or is there another identifier for jquery?

      Question C:
      When I use <rich:jQuery>, do I need to load the jquery-script via the ways described above or is the script automatically when using rich:jquery?

      Question D:
      When appliying a query-string in rich:jquery via the property 'query', can I use the $ for jquery?

      Question E:
      What about loading plugins for jquery, these plugins uses $. How can I handle that? Should I overwrite $ in all jquery-plugins or can I load it via a4j:loadScript without conflicts?

      Question F:
      Would it be not better to replace all prototype-scripts in richfaces via jquery-scripts in future? It seems, that jquery strikes prototype in many ways (for example, more plugins, smaller size, shorter ways and so on..). Dont you think so?

        • 1. Re: a4j:loadScript and rich:jquery
          nimo22

          Okay forget all questions, I have overseen the manual, in there all answers are placed.

          But one question I have, is:

          Question E:
          What about loading plugins for jquery, these plugins uses $. How can I handle that? Should I overwrite $ in all jquery-plugins or is there a better way?

          • 2. Re: a4j:loadScript and rich:jquery
            nbelaevski

            Hello,

            Looks like yes, you should replace all $ with jQuery

            • 3. Re: a4j:loadScript and rich:jquery
              vladimir.kovalyuk

              Recently I had to go with option E. I embedded textarea autogrow plugin which contained $ in source code. It started to work after I had replaced all the $ occurences with jQuery.

              I've read some jQuery forums and it seems for me that jQuery plugin developers consider using $ in plugins as a bad practice. So I suppose you should go to jQuery bugtracker and create a ticket against the plugin you use.