Reputation: 3668
this may be simple for some of you so, here it goes. I need to wrap a div arround each ul-submenu:
<div class="this-is-a-div-arround"></div>
This would be the result:
<ul>
<li><a>1st level </a>
<ul><li><a>2nd level</a></li></ul> ** -- add div here
</li>
</ul>
And change the javascript to keep the menu to work of course. Link: http://j.mp/XJjPfB
Upvotes: 0
Views: 218
Reputation: 73896
$('ul').find('ul').wrap('<div class="this-is-a-div-arround"></div>');
Upvotes: 1
Reputation: 8275
Just use this code:
$("ul ul").wrap("<div class='this-is-a-div-arround'/>");
$("ul ul")
find all nested ul
and wrap
add the element around these found ul
.
Upvotes: 2