denhamd2
06-29-2011, 11:51 PM
Hi,
I'm a bit of a newbie with Javascript. I have an array called "Prods". Here are the different values in that array:
ProductName, HowManyCalories, ProductImage, LinkFromImage, Description, Price, BuyLink
There are a number of products. I'm just wondering how do I use "ProductName" as a product key to output its unique values?
Eg. the ProductName is "Chocolate Spread" - how do I output the "HowManyCalories" and "Product Image" only from the "Prods" array, based on the key "Chocolate Spread"?
Here's what I would like to do. I have the HTML:
<div><img src="" id="prodAimg"><br><span class="prodAname"></span><br><span class="prodAprice"</div><div><img src="" id="prodBimg"><br><span class="prodBname"></span><br><span class="prodBprice"</div><div><img src="" id="prodCimg"><br><span class="prodCname"></span><br><span class="prodCprice"</div>
I'm trying to use jquery to traverse the array and populate the above product images, names and prices with the values from the array, purely based on the
product names (ie. prodAname, prodBname, prodCname).
Sorry if this sounds confusing. Let me know what you think?
I'm a bit of a newbie with Javascript. I have an array called "Prods". Here are the different values in that array:
ProductName, HowManyCalories, ProductImage, LinkFromImage, Description, Price, BuyLink
There are a number of products. I'm just wondering how do I use "ProductName" as a product key to output its unique values?
Eg. the ProductName is "Chocolate Spread" - how do I output the "HowManyCalories" and "Product Image" only from the "Prods" array, based on the key "Chocolate Spread"?
Here's what I would like to do. I have the HTML:
<div><img src="" id="prodAimg"><br><span class="prodAname"></span><br><span class="prodAprice"</div><div><img src="" id="prodBimg"><br><span class="prodBname"></span><br><span class="prodBprice"</div><div><img src="" id="prodCimg"><br><span class="prodCname"></span><br><span class="prodCprice"</div>
I'm trying to use jquery to traverse the array and populate the above product images, names and prices with the values from the array, purely based on the
product names (ie. prodAname, prodBname, prodCname).
Sorry if this sounds confusing. Let me know what you think?