Skip to content

Instantly share code, notes, and snippets.

@wiyoe
Created February 1, 2018 13:08
Show Gist options
  • Select an option

  • Save wiyoe/faad6884b550a57ddde1145d6002d68f to your computer and use it in GitHub Desktop.

Select an option

Save wiyoe/faad6884b550a57ddde1145d6002d68f to your computer and use it in GitHub Desktop.
Jquery get table data to array.
var list = [];
$('table.resource-summary > tbody > tr').each(function(i, el) {
var $tds = $(this).find('td');
var obj = {
field_name: $tds.eq(0).text(),
description: $tds.eq(1).text(),
}
list.push(obj);
});
console.log(JSON.stringify(list));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment