Skip to content

Instantly share code, notes, and snippets.

@brianpow
Created January 15, 2016 15:37
Show Gist options
  • Select an option

  • Save brianpow/9a31dc44f82d9ac20bc3 to your computer and use it in GitHub Desktop.

Select an option

Save brianpow/9a31dc44f82d9ac20bc3 to your computer and use it in GitHub Desktop.
title=["Brand","Name","Size","Price"];
selectors=["dl.productWrapper:eq(0) strong:eq(0)",
"dl.productWrapper:eq(0) a.breakWorkW",
"dl.productWrapper:eq(0) span:eq(0)",
"dl.productWrapper:eq(1) font:eq(0)"];
all=[]
jQuery("div.productCol").each(function(){
a=[];
for(var i in selectors)
a.push(jQuery(selectors[i],this).text().trim());
all.push(a.join("\t"));
})
console.log(all.join("\n"));
if(!jQuery("textarea#xx").size())
jQuery(document.body).append("<textarea id='xx' rows=80 cols=80></textarea>");
jQuery("textarea#xx").html(title.join("\t")+"\n"+all.join("\n"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment