javascript - how to get clone element of queryselectorall and append to another div - Stack Overflow

How to get clone elements of more than one specific classes list and append to another tag.var elements

How to get clone elements of more than one specific classes list and append to another tag.

var elements = document.getElementById('main_iframe').contentDocument.querySelectorAll(".optdel, .optbold");
var editsummary = document.getElementById("opteditsum");

    for (var i=0, im=elements.length; im>i; i++) {                        
      editsummary.appendChild(elements[i]);          
    }

How to get clone elements of more than one specific classes list and append to another tag.

var elements = document.getElementById('main_iframe').contentDocument.querySelectorAll(".optdel, .optbold");
var editsummary = document.getElementById("opteditsum");

    for (var i=0, im=elements.length; im>i; i++) {                        
      editsummary.appendChild(elements[i]);          
    }
Share Improve this question edited Jul 6, 2017 at 13:53 Cœur 38.8k25 gold badges206 silver badges279 bronze badges asked May 9, 2015 at 5:46 SmilaSmila 1,1409 silver badges16 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Assuming there are no same originl policy constrains, you can clone the node

var elements = document.getElementById('main_iframe').contentDocument.querySelectorAll(".optdel, .optbold");
var editsummary = document.getElementById("opteditsum");

for (var i = 0, im = elements.length; im > i; i++) {
    editsummary.appendChild(elements[i].cloneNode(true));
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745556116a4632830.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信