How should I add multiple identical elements to a div with jQuery

前端 未结 4 557
粉色の甜心
粉色の甜心 2020-12-31 09:13

I need to add multiple empty divs to a container element using jQuery.

At the moment I am generating a string containing the empty html using a loop

         


        
4条回答
  •  孤城傲影
    2020-12-31 09:31

    You can use a regular loop with the Jquery append function.

    for(i=0;i<10; i++){
        $('#container').append("
    "); }

提交回复
热议问题