Is it possible to use javascript to search for an exact line of html and remove it without the element having a class or id?
For example I have a unordered list of items loading into the page from a source I have no control over and it looks a bit like this
<div class="content">
<ul>
<li class="thumb">
<a href="#" title="something"><img src="http://img.png" alt="" ></a>
</li>
<li class="info">
<ul>
<li>something 1</li>
<li><a href="#" title="something 1">Something 1</a></li>
</ul>
</li>
</ul>
<!-- I want to remove from here.. -->
<ul>
<li class="thumb">
<a href="#" title="something 2"><img src="http://img.png" alt=""></a>
</li>
<li class="info">
<ul>
<li>something 2</li>
<li><a href="#" title="something 2">Something 2</a></li>
</ul>
</li>
</ul>
<!-- ..to here -->
<ul>
<li class="thumb">
<a href="#" title="something 3"><img src="http://img.png" alt=""></a>
</li>
<li class="info">
<ul>
<li>something 3</li>
<li><a href="#" title="something 3">Something 3</a></li>
</ul>
</li>
</ul>
</div>
My goal is to use javascript (if possible) to remove the entire <ul>
that contains "Something 2"
, the itself wont change at all but the order of the lists might.. so using css like:
.content ul:nth-child(2) {
display:none;
}
isn't an option sadly. Also I have no ability to use PHP to do this either. Can something like this be done with javascript? and how?
Try this.