I have this structure HTML
.
var subMenuElementos = $('#menu nav ul li a');
subMenuElementos.removeAttr('href');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="menu">
<nav>
<ul>
<li><a href="https://google.com">Quiero quitar su href</a></li>
<li><a href="https://google.com">Quiero quitar su href</a>
<div class="sub-menu">
<ul>
<li><a href="https://google.com">Quiero conservar su href</a></li>
<li><a href="https://google.com">Quiero conservar su href</a></li>
</ul>
</div>
</li>
<li><a href="https://google.com">Quiero quitar su href</a></li>
<li><a href="https://google.com">Quiero quitar su href</a></li>
<li><a href="https://google.com">Quiero quitar su href</a>
<div class="sub-menu">
<ul>
<li><a href="https://google.com">Quiero conservar su href</a></li>
<li><a href="https://google.com">Quiero conservar su href</a></li>
</ul>
</div>
</li>
<li><a href="https://google.com">Quiero quitar su href</a></li>
</ul>
</nav>
</div>
The problem is that I am not selecting correctly the <a>
tags I want.
What would be the correct way to select them?