Copying a node in JavaScript without actually copying whole node | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Copying a node in JavaScript without actually copying whole node

I want to copy a node <li> and append it to its parent element <ol> with onclick function The thing is inside main <li>, there is another <ol> and a button which does same thing, i.e appends a <li> element to <ol> with onclick function When I append the outer <li>, the whole first <li> is copied and appended as next <li>, But I do not want the inner list to have more than one element in second child of outer list. If I click on inner button 2-3 times and then append main <li> element as next child of outer list, the inner list of second child of outer list has 2-3 elements as same. I do not want that.

8th Jun 2020, 2:41 PM
Sameep Kulkarni
Sameep Kulkarni - avatar
1 Answer
+ 1
Did you know, that here cannot anything happends before you will link your code?
8th Jun 2020, 3:23 PM
JaScript
JaScript - avatar