Question

I'd like to extract all the ISBNs on a dynamic web page that I can't feed through a Yahoo Pipe (the user has to log in to see the page). Is there a way to do that with jQuery? How?

Edit: The structure:

Here's an example of what the HTML looks like on that page. There's a <table> that has a series of <tr> elements in them. A sample one of those looks roughly like this:

<tr> 
  <td>(required/optional)</td>
  <td>LAFORE</td>
  <td>OBJECT ORIENTED PROGRAMMING IN C++ 4E</td>
  <td>9780672323089</td>
  <td>(course and section)</td>
  <td>(pricing information)</td>
</tr> 

There are no id attributes on any of these, the structure is well defined though.

Thanks!

Was it helpful?

Solution

//ideally provide better table selector if multiple tables are there
var isbns = $.makeArray($("table tr td:nth-child(4)"));
for(var i in isbns) {
  isbns[i] = isbns[i].innerHTML;
  alert(isbns[i]);
}
//now isbns is an array which contains all isbns found in the table
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top