How do I use jQuery in firefox addon?

I want to use jQuery in the sidebar of my firefox extension. This is how I include jQuery in the sidebar.xul

  <script type="application/x-javascript" src="chrome://myaddon/content/
  scripts/jquery/js/jquery-1.4.4.min.js"/>

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

First question, why do we use the jQuery.noConflict() function?

I tried the solutions of some other questions but it did not work for me.

Still this does not work for me on FF 3.6.13:

<script type="application/x-javascript" 
       src="chrome://myextension/content/scripts/jquery/js/jquery-1.4.4.min.js"/>
  <script type="text/javascript">
    jQuery.noConflict();
    jQuery(document).ready(function () {
        alert("hello");
    });
 </script>
5
задан Upvote 16 February 2011 в 13:57
поделиться