I have a ul>li structure using jQuery Mobile that looks like this:
<div>
<ul data-role="listview">
<li><a href="#" class="FoodDrinkItem">Hamburger<p class="FoodDrinkPrice">$9.00</p></a></li>
<li> <a href="#" class="FoodDrinkItem">Club Sandwich<p class="FoodDrinkPrice">$7.00</p></a></li>
</ul>
</div>
I want to get the price of the item when I click the specific li.I would like to do this with classes because its easier to expand afterwards.
$(document).ready(function(){
$(".FoodDrinkItem").click(function(){
var price = $(".FoodDrinkPrice").text();
$("#PopupFoodDrinkPrice").text(price);
});
});
How can I take the className.text() of the selected li?