In order to override CSS that I can not change, I need to add the class "hide" to the first li with an "!important" rule when the text "Turkey | Meats" is present.
Now, when I attempt to remove the "hide" class with .removeClass(), "hide" still remains and I think it's because of the "!important" rule. Here's my coding:
(function($) {
if ($(".nav li:nth-of-type(2)").text().trim() == "Turkey | Meats") {
$(".nav li:nth-of-type(1)").addClass("hide");
} else {
$(".nav li:nth-of-type(1)").removeClass("hide");
}
});
.hide {
display:none !important;
}
<div class="nav">
<ul class="nav-list">
<li class="nav-link">
<a href="">Fish</a>
</li>
<li class="nav-link">
<a href="">Turkey | Meats</a>
</li>
</ul>
</div>