I need help working with this list element
<li class="list-group-item d-flex justify-content-between align-items-center"><span class="product_name" style="font-size:24px; color:#870FD1" data-price= "121.34"><i class="bi bi-plus-circle"></i></span> Bleed Hydraulic brake system - ABS <span class="product_name"><u>More info</u></span></li>
Specifically, I am trying to extract the price value data-price= "121.34"
and the product description
Bleed Hydraulic brake system - ABS
I have designated the clicked icon as
<i class="bi bi-plus-circle"></i>
, but struggling to access the data attribute of its parent element
$(".bi-plus-circle").click(function(){
alert($('.bi-plus-circle').parent().attr('price'));
});
Despite having multiple <li></li>
elements, my current method is not yielding the desired information
$(".bi-plus-circle").click(function(){
alert($(this).parent().attr('price'));
});
Any suggestions on how to successfully retrieve both the price and product details?