Copy the content of a div into another div

前端 未结 4 1370
野性不改
野性不改 2020-12-09 19:01

I have two divs on my website. They both share the same css properties, but one of them holds 24 other divs. I want all of these 24 divs to be copied into the other div. Thi

4条回答
  •  無奈伤痛
    2020-12-09 19:22

    You can use the .ready() event of jquery

    jQuery(document).ready(function() {
        jQuery('.div1').html(jQuery("#div2").html());
    }
    

    Also a working DEMO.

提交回复
热议问题