[jQuery] wrapping or cloning problem

[jQuery] wrapping or cloning problem

Hi All.
I want to accordion an existing content format, and I think that I need
to insert a wrapper element. First I would love a sanity check on my
general approach then maybe someone can critique the manipulation I'm
trying.
Here's my content:
<div class="accordion">
<h3>heading</h3>
<arbitrary content/>
</div>
I can't change the content and I need the heading to be used as the
clickable bar.
The approach I want to take (on a high level) is:
- put a div around everything after the h3 in the dives classed
"accordion"
- put events on the h3 to show the associated div and hide the
non-associated divs
The js I would use is something like:
$("div[@class=accordion]").removeClass("accordion").addClass("accordionI
nner");
$("div[@class=accordionInner]").wrap('<div class="accordion"></div>');
//no luck here:
$("div:[@class=accordion]").each(function(i){$(this).prepend($(this).chi
ldren("div[@class=accordionInner]:firstChild)})
//nor with this:
$("div[@class=accordion]").each(function(i){$(this).children("div[@class
=accordionInner]:first-child").clone().prependTo(this)})
All suggestions welcome!
----------->Nathan
.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:
||:.
Nathan Young
Cisco.com->Interface Development
A: ncy1717
E: natyoung@cisco.com
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/