Complainingest
Complainingest

Reputation: 28

How to find sets of <li> and wrap with <ul> using jQuery?

I'm working on an internal application for generating markup from pasted email content, and as I'm only a designer, I'm using the only thing I kind of know: jQuery. I've managed to piece together enough so that I'm getting this:

<p>Some paragraph content is here.</p>

<li>list item 1a
<li>list item 1b
<li>list item 1c

<p>More paragraph content is here.</p>

<li>list item 2a
<li>list item 2b
<li>list item 2c

So I'm getting list items without an unordered list element. There may be multiple lists, as in the above example. How can I add the ul's so that they wrap correctly around the list items?

Upvotes: 0

Views: 76

Answers (1)

Filip
Filip

Reputation: 2522

Maybe this could help you?

http://api.jquery.com/nextUntil/

Upvotes: 4

Related Questions