Hi guy,
I got a markup looking like this :
<body>
<...
a lot of tags from the web site
...>
<script type="text/javascript" src="http://cdn.jquerytools.org/1.1.1/jquery.tools.min.js"></script>
<script type="text/javascript" src="my_script.js"></script>
<body>
I want it to end up that way :
<body>
<div...
I'm working on a dropdown menu and need to mutate the existing html markup with JQuery to make it fit the design.
Here is a simplified example:
Wrap all "ul's" that contain more than one "li" in a div (in the same div, NOT one div for each UL).
<ul>
<li>foo</li>
</ul>
<ul>
<li>foo</li>
<li>foo</li>
</ul>
<ul>
<li>foo</l...
Hi Guys,
I'm parsing an xml file and I want to wrap children divs into a div called "new":
I have something similar to below:
function parseXml(xml)
{
$(xml).find("hotel").each(function()
{
$('<div class="wrapme"></div>').html($(this).find("hotel_name").text()).appendTo('#foo');
});
}
$('.wrapme').wrapAll('<div class="group" />');...
Is it possible to use nth-child selectors to wrap 3 divs using .wrapAll. I can't seem to work out the correct equation.
so...
<div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
becomes...
<div>
<div class="new">
<div></div>
<div></di...
Hi,
I'm using a bit of code suggested by a member on stackoverflow and adapted by me to wrap every 3 li items as part of a mega menu. The code is:
var lis = $("ul > li");
for(var i = 0; i < ls.length; i+=3) {
lis.slice(i, i+3).wrapAll("<div class='new'></div>");
}
Unfortunately this will grab child li's from the next parent menu to ...