<div style="display: block;" class="Topping-details" id="4">
<section id="topping_tsection_4">
<aside>
<h6 class="tdHeading">Quantity 1</h6>
<section class="secclass"><a topping_id="1" topp_name="Honey with Chocolate Sauce 10 ML" top_price="25" class="tpActive" >Honey with Chocolate Sauce 10 ML</a>
</section>
<section class="secclass"><a topping_id="2" topp_name="Honey with Carmel 10 ML" top_price="25" class="tpActive" >Honey with Carmel 10 ML</a>
</section>
</aside>
<aside>
<h6 class="tdHeading">Quantity 2</h6>
<section class="secclass"><a qt_val="111" top_price="25" >Honey with Chocolate Sauce 10 ML</a>
</section>
<section class="secclass"><a qt_val="111" top_price="25" class="tpActive">Honey with Carmel 10 ML</a>
</section>
</aside>
</section>
</div>
Привет,Как проверить hasclass при использовании для цикла
Это мой HTML ответ, на нажатие кнопки я пытаюсь получить значение атрибута top_price последнего в сторону секции
Я попробовал это так, но его не workng
$(document).on("click", ".work", function() {
var id_attr_val=4;
$(this).find(".Topping-details").find('section#topping_tsection_'+id_attr_val+' aside:last').find('.tpActive').each(function() {
var top_price = $(this).attr("top_price");
alert(top_price);
});
});