In my application i am listing ProdutId(not visible to user), Oty(ordered by user) and other information.When i click button i want to loop
this list and retrieve product id and qty from html elements.All elements in list i am giving id. How can overcome this issue?
Below I am providing my dynamic code to generate my list
Member
35 Points
156 Posts
Loop through html elements and retrieve value
Jun 18, 2020 06:03 AM|binustrat|LINK
In my application i am listing ProdutId(not visible to user), Oty(ordered by user) and other information.When i click button i want to loop
this list and retrieve product id and qty from html elements.All elements in list i am giving id. How can overcome this issue?
Below I am providing my dynamic code to generate my list
$("#divViewCart").append("<div id=divCartParentList;style=width:300px;height:200px;background-color:orange>"
+ "<span id=spnCartProdName" + value.Id + ">" + value.ProductName + "</span>"
+ "<span id=spnCartProdBrand" + value.Id + ">" + value.BrandName + "</span>"
+ "<span id=spnCartProdPrice" + value.Id + ">" + value.ProdPrice + "</span>"
+ "<input type=button id=btnDecreaseQty-" + value.Id + " value =- onClick = DecreaseQty(this.id) /> "
+ "<span id=spnCartProdQty" + value.Id + ">" + value.Qty + "</span>"
+ "<input type=button id=btnIncreaseQty-" + value.Id + " value =+ onClick = IncreaseQty(this.id) /> "
+ "<input type=hidden id=hdnCartProdId" + value.Id + " value=" + value.Id + "/>"
+ " <span id=spnCartItemPTotalrice" + value.Id + ">" + parseInt(value.Qty) * parseInt(value.ProdPrice) + "</span> "
+ TotalAmount + " </div >"
)
I want to retrieve bolded value