Get content of a DIV using JavaScript

前端 未结 5 1893
自闭症患者
自闭症患者 2020-11-27 03:08

I have two DIV\'s called DIV1 and DIV2 and DIV1 consists of dynamic content and DIV2 is empty. I need content of DIV1 to be displayed in DIV2. How can I do it.

I cod

5条回答
  •  一个人的身影
    2020-11-27 04:05

    simply you can use jquery plugin to get/set the content of the div.

    var divContent = $('#'DIV1).html(); $('#'DIV2).html(divContent );

    for this you need to include jquery library.

提交回复
热议问题