Last active
October 11, 2021 17:52
-
-
Save jpluimers/8188dbdb643b1d6b0e5ef4b397b79e23 to your computer and use it in GitHub Desktop.
Convert a `dl` with id `delimitedList` into a `table` within a `div` named `here_table`, adopted from https://stackoverflow.com/questions/26386817/rebuild-each-definition-list-dl-as-a-table-using-jquery/26387182#26387182
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
<table id="here_table"></table> |
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
var arr = $("#delimitedList").children().map(function () { | |
return $(this).html(); | |
}).get(); | |
for (var i = 0; i < arr.length; i += 2) { | |
$('#here_table').append('<tr><td>' + arr[i] + '</td><td>' + arr[i + 1] + '</td></tr>'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment