how to clone content of a div to another div

前端 未结 4 1973
时光说笑
时光说笑 2021-02-01 03:08

I want to copy the content of a selected div to another div with jquery clone. but I dont want to append it anywhere

what I mean is when we make a clone of a div with j

4条回答
  •  滥情空心
    2021-02-01 03:57

    $("#from").clone().appendTo($("#to"));
    

    But it will not remove/hide the main DIV. To hide the main div, do this:

    $("#from").clone().appendTo($("#to"));
    $("#from").remove();
    

提交回复
热议问题