Created
October 26, 2020 07:04
-
-
Save mamedshahmaliyev/455e7f0d032c1460a2e1ee6375d2489d to your computer and use it in GitHub Desktop.
Populate or fill HTML table with random data in vanilla JavaScript
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 table_selector = '#table_id'; | |
var i = 0; | |
var content_length = 15; | |
document.querySelectorAll(table_selector + ' tr').forEach((row, i) => { | |
row.querySelectorAll('td').forEach((td, j) => { | |
td.innerHTML = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, content_length); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment