jQuery Tree View and wp_list_pages
<p>I'm looking to use the <a href="http://www.dynamicdrive.com/dynamicindex1/treeview/index.htm" rel="nofollow">jQuery TreeView</a> script on wp_list_pages to get a nice collapsable-tree effect going. </p>

<p>The script requires that I add some classes to the list elements such as:</p>

<pre><code>&lt;ul id="red" class="treeview-red"&gt;
</code></pre>

<p>So I tried putting this in my template:</p>

<p>First, load scripts on my template page via wp_enqueue_script() </p>

<pre><code>wp_enqueue_script("av_jquery_tree");
get_header();
</code></pre>

<p>Where "av_jquery_tree" is defined in a plugin:</p>

<pre><code>function av_jquery_tree() {
wp_register_script('jquery.treeview', get_template_directory_uri() . '/js/jquery.treeview/jquery.treeview.js', array('jquery'), '1.0' );
wp_register_script('jquery.cookie', get_template_directory_uri() . '/js/jquery.treeview/jquery.cookie.js', array('jquery'), '1.0' );
wp_enqueue_script('jquery.treeview');
wp_enqueue_script('jquery.cookie');
}
add_action('wp_enqueue_scripts', 'av_jquery_tree');
</code></pre>

<p>Second, In order to add the class and id to the first ul element on the page, I just insert this script above the call to wp_list_pages:</p>

<pre><code>&lt;script&gt;
    jQuery(document).ready(function(){
    jQuery("ul").first().attr("id", "red").addClass("treeview-red");
    });
&lt;/script&gt;
</code></pre>

<p>Unfortunately, my output is just a bunch of red lines across wp_list_pages. Also keep in mind that I'm using the Suffusion Theme, which <a href="http://aquoid.com/forum/viewtopic.php?f=4&amp;t=7466&amp;p=32243#p32243" rel="nofollow">preloads jquery</a>.</p>
