title: Why does Firebug error report say: jQuery("#accordion").accordion is not a function?
body: <p>I am developing a web app using the Joomla Framework.  The jQuery UI accordion function is not working for me.  The error reported by Firebug is that .accordion is not a function.   I have read a lot of pages addressing various similar errors but have not found a solution.</p>
  
  <p><strong>Here is what I have in the template for my component's view:</strong></p>
  
  <pre><code>$document =&amp; JFactory::getDocument();    
  $document-&gt;addScript( '/includes/js/jquery-1.4.2.js' );  
  $document-&gt;addScript( '/includes/js/jquery-ui-1.8.4.custom.min.js' );
  JHTML::script( 'includes/js/pfm_main_ui.js', '' );
  $document-&gt;addCustomTag( '&lt;script type="text/javascript"&gt;jQuery.noConflict();&lt;/script&gt;'    );
  </code></pre>
  
  <p><strong>Here is my included javascript (pfm_main_ui.js):</strong></p>
  
  <pre><code>jQuery(document).ready(function() {  
     jQuery('#accordion').accordion(  
          {  
              header: "h2"
          });  
        })
  </code></pre>
  
  <p><strong>Here is the html for the accordion in the template:</strong></p>
  
  <pre><code> &lt;div id="accordion"&gt;
   &lt;div&gt;
   &lt;h2&gt;&lt;a href="#"&gt;Header 1&lt;/a&gt;&lt;/h2&gt;
   &lt;div id="contentPanel_1"&gt;...content ...
   &lt;/div&gt;
   &lt;/div&gt;
   &lt;div&gt;
   &lt;h2&gt;&lt;a href="#"&gt;Header 2&lt;/a&gt;&lt;/h2&gt;
   &lt;div id="contentPanel_2"&gt;...content ...
   &lt;/div&gt;
   &lt;/div&gt;
   &lt;div&gt;
   &lt;h2&gt;&lt;a href="#"&gt;Header 3&lt;/a&gt;&lt;/h2&gt;
   &lt;div id="contentPanel_3"&gt;...content ...
   &lt;/div&gt;
   &lt;/div&gt;
   &lt;div&gt;
   &lt;h2&gt;&lt;a href="#"&gt;Header 4&lt;/a&gt;&lt;/h2&gt;
   &lt;div id="contentPanel_4"&gt;...content ...
   &lt;/div&gt;
   &lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p><strong>Other info:</strong></p>
  
  <p>Joomla by default uses mootools, so I have to call jQuery.noConflict() to use jQuery.  I believe this may be where the error is coming from, but cannot solve.  Any help is much appreciated!</p>