On the question of redrawing and rearranging, how to get the rendering completed event?

has a very long html string, and then I render it to div, and then I take the width of the div. I always get the width before I finish rendering, so the width is not accurate, what should I do?
what"s the solution?

Mar.02,2021

use setTimeout to get it asynchronously? Or if you are using vue, you can use Vue.nextTick



var div = document.getElementById('example');
var html = [];
for (var i = 0; i < 100000; iPP) {
    html.push('<span>' + i + '</span>');
}
$('-sharpexample').html(html.join(' '));
setTimeout(function() {
    var width = $('-sharpexample').text().length;
    console.log(width);
}, 0);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35a96-4ec17.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35a96-4ec17.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?