Last active
December 27, 2015 09:59
-
-
Save j127/7307563 to your computer and use it in GitHub Desktop.
This file contains 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
// Create a table and attach to the target div | |
myTable = $('<table><caption><thead><tbody>').appendTo('#myDiv'); | |
// Loop through object and put the keys/values in table cells on the page | |
Object.keys(obj).forEach(function(key) { | |
if (obj[key] !== null) { | |
currentRow = $('<tr>'); | |
cell1 = $('<td>').text(key).appendTo(currentRow); | |
cell2 = $('<td>').text(obj[key]).appendTo(currentRow); | |
currentRow.appendTo('tbody'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment