I'm trying to replace two divs that has separate ul elements into a single one, so I can create a single ul with the li of both, but my current code creates separate ul, and that is not my intended purpose, could anyone enlighten me on how to make the proper selection for these:
my jQuery
$('nav div.moduletable_gfbb_navigationbar, nav div.moduletable_menu_navigationbar').replaceWith(function(){
var html = '<ul class="nav navbar-nav navbar-right">';
$(' ul',this).each(function(){
html += $(this).html();
});
html+='</ul>';
return html;
});
my HTML
<div class="moduletable_menu_navigationbar">
<ul class="menu">
<li id="current" class="active item8"><a href="http://localhost/html/"><span>Banca Personas</span></a></li>
<li class="item9"><a href="/html/banca-pyme.html"><span>Banca Pyme</span></a></li>
<li class="item10"><a href="/html/banca-empresas.html"><span>Banca Empresas</span></a></li>
<li class="item602"><a href="/html/bankard.html"><span>Bankard</span></a></li>
</ul>
</div>
<div class="moduletable_gfbb_navigationbar">
<ul class="menu">
<li class="item12"><a href="/informacion-institucional.html"><span>Informacion Institucional</span></a></li>
</ul>
</div>
And the output I get (not what I want)
<ul class="nav navbar-nav navbar-right">
<li class="item12"><a href="/informacion-institucional.html"><span>Informacion Institucional</span></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li id="current" class="active item8"><a href="http://localhost/html/"><span>Banca Personas</span></a></li>
<li class="item9"><a href="/html/banca-pyme.html"><span>Banca Pyme</span></a></li>
<li class="item10"><a href="/html/banca-empresas.html"><span>Banca Empresas</span></a></li>
<li class="item602"><a href="/html/bankard.html"><span>Bankard</span></a></li>
</ul>
What I want is a single 'ul', I know I can recode it, but I'm trying to use the less code posible.