Created
February 1, 2018 13:08
-
-
Save wiyoe/faad6884b550a57ddde1145d6002d68f to your computer and use it in GitHub Desktop.
Jquery get table data to array.
This file contains hidden or 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
| 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