Jquery function closing div on append by itself

前端 未结 3 659
旧巷少年郎
旧巷少年郎 2021-01-11 11:12

I have the following function:

function displayResults(Items) {
                $(\"#result\").text(\"\");
                $(\"#result\").append(\'
3条回答
  •  感情败类
    2021-01-11 11:54

    This is an issue I've just come across too. An option is to create the div containers first in a loop then populate them after as you require:

    for(var i = 0; i < 12; i++){
    
        $(el).append('
  • '); // create container li tags //fill empty li tags with content for(var j = 0; j < 2; j++){ $(el).find('li').last().append('
    '); } }

提交回复
热议问题