On my page, there is a section with the following code:
<h5 class="text-center" id="findStore" style="width:260px">
<a data-toggle="collapse" data-parent="#accordion" href="#@item.ProductId" aria-expanded="true" aria-controls="@item.ProductId" style="color: @item.ProductTextColor;font-size:19px;text-decoration: none;" class="text-center">
<span class="text-center" style="margin-left:14%">FIND A STORE</span>
<span id="chevvy" class="glyphicon glyphicon-chevron-down pull-right"></span>
</a>
</h5>
When the user clicks on "Find Store", I want to change the class of a specific span tag (with ID chevvy) from chevron-down to chevron-up. Here's the code I am trying to use for this:
$('h5:not(#nutritionInfo)').click(function () {
if ($(this).find('span').hasClass("glyphicon glyphicon-chevron-down")) {
$(this).find('span').removeClass("glyphicon glyphicon-chevron-down");
$(this).find('span').addClass("glyphicon glyphicon-chevron-up");
} else {
$(this).find('span').removeClass("glyphicon glyphicon-chevron-up");
$(this).find('span').addClass("glyphicon glyphicon-chevron-down");
}
});
However, this code ends up applying the chevron transformation to "Find Store" as well, resulting in two chevrons being displayed. How can I specifically target the other span tag with ID chevvy and change its chevron class?