How to clone element with given class name
问题 I am using getElementById when I need to clone the div element. Code: printHTML( document.getElementById("div_name").cloneNode(true)); Now I need to use getElementsByClassName CloneNode is not working when using getElementsByClassName . How can I put class name in here? Thank's EDIT: When I try to use this: printHTML( $('.dataTables_scroll').clone(true) ); You can see my function: function printHTML(clonedDive){ var iframe = document.createElement("iframe"); document.body.appendChild(iframe);