Skip to content

Instantly share code, notes, and snippets.

@israelshirk
Created December 22, 2013 02:43
Show Gist options
  • Select an option

  • Save israelshirk/8077857 to your computer and use it in GitHub Desktop.

Select an option

Save israelshirk/8077857 to your computer and use it in GitHub Desktop.
Extract prices from Photoshelter pricing page
var varsToSelectors = {
size: ["td.groupCat.size", "html"],
name: ["td.name", "html"],
vendor: ["td.vendor", "html"],
'type': ["td.type", "html"],
finishes: ["td.finishes", "html"],
wholesale: ["td.wholesale", "html"],
price: ["td.price input:first", "val"]
}
jQuery("tr.USER.priced").each(function() {
var jThis = jQuery(this);
result = {};
for (var column in varsToSelectors) {
field = jThis.find(varsToSelectors[column][0]);
if (varsToSelectors[column][1] == "html") {
result[column] = field.html();
} else {
result[column] = field.val();
}
}
console.dir(JSON.stringify(result));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment