Skip to content

Instantly share code, notes, and snippets.

@hoffm
Last active January 10, 2017 16:32
Show Gist options
  • Save hoffm/dabd311a2b6a974c5fd496aa75d88964 to your computer and use it in GitHub Desktop.
Save hoffm/dabd311a2b6a974c5fd496aa75d88964 to your computer and use it in GitHub Desktop.
Display a table of all product names and prices from a Food52 shop page
// Display a table of all product names and prices from a Food52 shop page
var names = [],
attributes = [];
_.each($(".product-result"), function(tile){
var prodName = $(tile).children(".product-result-title").first().text(),
prodPrice = $(tile).children(".product-result-desc").first().text().split("\n")[0],
prodImg = $(tile).children("img").first().attr("src");
names.push(prodName);
attributes.push({price: prodPrice, image: prodImg})
})
console.table(
_.object(names, attributes)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment