Can someone send me a JavaScript code implementing the cloneNode property | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someone send me a JavaScript code implementing the cloneNode property

javascript

17th Nov 2018, 6:37 AM
Asimobi Emmanuel
Asimobi Emmanuel - avatar
2 Answers
0
The base code are newnode = node.cloneNode(deep) Its like a creating a copy of html element(node) for your code, not visible in html thus you can manipulate it the way you wanted because it wont cause any effect to the original element. deep in the cloneNode parameter is to define wheter you also want to copy all of its childNode or not. I havent find an use it for any of my project so i cant show the implementation
17th Nov 2018, 6:51 AM
Taste
Taste - avatar
0
I understand that part of the gist. But how is it used in an actual javaScript code. for instance how do I make the following code run https://code.sololearn.com/WP4syqeIQzZE/?ref=app
17th Nov 2018, 7:09 AM
Asimobi Emmanuel
Asimobi Emmanuel - avatar