title: JQuery confilct
body: <p>I have a weird situation where two JQueries having conflict.</p>
  
  <p>Here are the codes:</p>
  
  <p>First Code:</p>
  
  <p>This code used to generate a tree list on the left of the page and modify some parts of the page</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      $(document).ready(function() {
          $("#generate").click(function() {
              var texts = [];
              $("form label").each(function() {
                  var oLabel = $(this);
                  var oInput = oLabel.next();
                  if(oLabel.val() == "Best Regards,")
                  {
                      alert(oInput.val());
                      texts.push(oLabel.text());
                      texts.push(oInput.val());
                  }
                  else
                      texts.push(oLabel.text() + " " + oInput.val());
              });
                  texts[0] += " " + texts[1];
                  texts[1] = texts[2] + " " + texts[3];
                  for(i=4;i&lt;texts.length;i++)
                      texts[i-2] = texts[i];
                  texts[texts.length-2] = texts[texts.length-3];
                  texts[texts.length-3] = $("#agent").val() ;
                  texts[texts.length-1] = null;
              $("#cont").fadeOut('fast').hide();
              $("#fe_text").html(texts.join("\n"));
              $("#template").css('visibility','visible');
              $("#template").fadeIn('slow').show();
  
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Second Code:</p>
  
  <p>This code is used to copy specific <code>&lt;textarea&gt;</code> to clipboard</p>
  
  <pre><code>&lt;script type="text/javascript" src="swf/ZeroClipboard.js"&gt;&lt;/script&gt;
  &lt;script language="JavaScript"&gt;
      var clip = null;
      try
      {
      function $(id) { return document.getElementById(id); }
      }
      catch(e)
      {
          alert(e);
      }
      function init() {
          clip = new ZeroClipboard.Client();
          clip.setHandCursor( true );
  
          clip.addEventListener('load', function (client) {
              debugstr("Flash movie loaded and ready.");
          });
  
          clip.addEventListener('mouseOver', function (client) {
              // update the text on mouse over
              clip.setText( $('fe_text').value );
          });
  
          clip.addEventListener('complete', function (client, text) {
              debugstr("Copied text to clipboard: " + text );
          });
  
          clip.glue( 'd_clip_button', 'd_clip_container' );
      }
  
      function debugstr(msg) {
          var p = document.createElement('p');
          p.innerHTML = msg;
          $('d_debug').appendChild(p);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>and here is the error (using Google Chrome JS Console).</p>
  
  <pre><code>Uncaught TypeError: Cannot call method 'treeview' of null
    (anonymous function)template2.php:17
    c.extend.readyjquery-1.4.min.js:314
    Mjquery-1.4.min.js:483
  template2.php:91Uncaught TypeError: Cannot call method 'hide' of null
    (anonymous function)template2.php:91
    onload
  </code></pre>
  
  <p>I hope anyone could help me with this.</p>