Looking for a way to remove a bit of html code if content is inside a li tag with the class has-megamenu
My code is as follows:
<ul class="uk-navbar-nav">
<li class="has-megamenu"><a href="#" aria-expanded="false" class="">Products</a>
<div class="navbar-dropdown uk-dropdown" uk-dropdown="offset:0;delay-hide:100;" style="...">
<ul class="uk-navbar-dropdown-nav>
<div class="navbar-dropdown-grid uk-grid">
<div class="uk-width-1-3">
<ul class="navbar-dropdown">
<li><a href="#">Icons</a></li>
<li><a href="#">Illustration</a></li>
</ul>
</div>
</div>
</ul>
</div>
</li>
</ul>
What I wish to remove (with jquery) is this part of code (along with the closing div/ul tag. All content within these html tags should remain and not be removed/replaced.
<div class="navbar-dropdown uk-dropdown" uk-dropdown="offset:0;delay-hide:100;" style="...">
<ul class="uk-navbar-dropdown-nav>
Can anyone put me on the right track?
if( $( "uk-navbar-nav" ).has( ".has-megamenu" )){
...
}