Last active
January 10, 2017 16:32
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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