Javascript Jquery在构建大层次结构时查找和附加性能问题
我需要递归地读取一个层次结构的JSON对象,并以与子对象插入父对象相同的方式构建HTML 例如:Javascript Jquery在构建大层次结构时查找和附加性能问题,javascript,jquery,performance,find,append,Javascript,Jquery,Performance,Find,Append,我需要递归地读取一个层次结构的JSON对象,并以与子对象插入父对象相同的方式构建HTML 例如: .... N儿童 ... N儿童 ... N父母 现在,我正在使用以下代码构建此文件: function buildDivHtml(); // This generates all the parent/children code at that particular moment, meaning one by one. object.find('selector of the row
.... N儿童
... N儿童
... N父母
现在,我正在使用以下代码构建此文件:
function buildDivHtml(); // This generates all the parent/children code at that particular moment, meaning one by one.
object.find('selector of the row where the append goes').append('html from above function');
这会导致浏览器冻结。是否有一种方法可以在不冻结浏览器的情况下完美地执行此操作?是否在循环中追加?是的,我在每个循环中追加,因为它是分层数据