Wrap several elements for accordion in jquery
Posted
by daveredfern
on Stack Overflow
See other posts from Stack Overflow
or by daveredfern
Published on 2010-02-23T12:09:22Z
Indexed on
2010/05/08
2:08 UTC
Read the original article
Hit count: 310
Hello,
I currently have the following html:-
<h3 />
<p />
<p />
<ul />
<ol />
<h3 />
<p />
<p />
<ul />
<ol />
<h3 />
<p />
<p />
<ul />
<ol />
I'd like to create an accordion but for this I need the following:-
<h3 />
<div>
<p />
<p />
<ul />
<ol />
</div>
<h3 />
<div>
<p />
<p />
<ul />
<ol />
</div>
I have tried the following:-
$('.page2 .articleText p, .page2 .articleText ul').after('<div class="accordion">');
$('.page2 .articleText h4:not(:first)').before('</div>');
But this doesnt work.
ANy help is much appreciated.
Thanks!
© Stack Overflow or respective owner