JSFiddle - React, Tailwind, and code Playground
by maaikeb
HTML
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<div id="log"></div>
<button>empty</button>
<table></table>
CSS
tr, td, th {
float: left;
}
JavaScript
$(function() {
var tableContent = ''
_print('before build');
for (i = 0; i < 10000; i++) {
tableContent += '<tr>';
for (j = 0; j < 5; j++) {
tableContent += '<td>' + j + '</td>';
}
}
tableContent += '</tr>';
_print('after build');
_print('before append');
$('table').append(tableContent);
_print('after append');
$('button').on('click', function() {
_print('before empty');
$('table').empty();
_print('after empty');
})
function _print(str) {
var log = new Date().toISOString().substr(14, 8);
$('#log').append('<div>' + log + ' - ' + str + '</div');
}
})