0
I have the following HTML:
<div class="segura-li">
<li class="classe-li">
<a href="link1">texto</a>
</li>
<li class="classe-li">
<a href="link2">texto</a>
</li>
<li class="classe-li">
<a href="link3">texto</a>
</li>
</div>
How to remove ONLY elemtno li
that within the a
have the URL link2
?
If I do that I’ll remove all:
$('.segura-li').removeClass('.classe-li');
But you want to remove the element
<li>
or his class?– Woss
The element, I edited my question
– caiocafardo
If to remove the element, it can be
$('.segura-li [href="link2"]').closest("li").remove()
– Sam
And why did you use
removeClass
?– Woss
It may also be:
$('[href="link2"]').closest("li").remove()
if there is only this link on the page... there are several possibilities.... can be also$(".segura-li .classe-li:eq(1)").closest("li").remove()
... Only that question contradicts what you just commented: "The element, I edited my question".– Sam
Just you have to answer what you want to do. The title of the question says one thing and the text says another.
– Sam