Is there a way to dynamically add a class to the span element inside a specific div when that div is clicked? There are multiple divs and spans with the same class name.
$('.menu_item_conteiner').click(function() {
$('.menu_item_conteiner').removeClass("tab_selected");
$(this).addClass('tab_selected');
// This adds a class to the last span, not the one inside the clicked div.
// $(".menu_item_conteiner span:last").addClass("show_element");
});
HTML
<span class="menu_item_conteiner">
<span class="menu_item">
Text
</span>
<span class="menu_imagen_icon">
</span>
</span>