I need to hide/show an <li>
based on its text content. In the example below, I want to only show the list item that contains "content 1" and hide the rest of the list items. I'm sure there are several ways to do this. Would I need to convert the list to an array and then use the "includes" method, then append style display none/ display block using a conditional statement?
I would have several unordered lists on a page and therefore target them with the wrapper div's ID.
<div id="myDiv">
<ul class="myList">
<li>content 1</li>
<li>content 2</li>
<li>content 3</li>
<li>content 4</li>
</ul>
</div>