Hello!
There is a form: http://jsbin.com/obihat/1/edit Two fields should be added to it by clicking on ADD, in the upper part of the form and in the lower one. At the same time, next to each field in the upper part of the form there should be a delete button, on clicking on which the corresponding field in the lower part of the form will be deleted.
I would be grateful, for any impulse, a hint towards the right decision.
UPDATED : I specify the question: How do I click on the DELETE button at the top of the form to delete the corresponding field at the bottom. Those. Initially, by clicking on ADD we made appendChild in both forms, now how do you know for which field of the second form do you need to removeChild along with removing this.parentNode of the top form?
ps: At this stage, when creating fields, I put them unique data-id, and then after them I delete them. But this one is still a bicycle, it seems to me that there is something simpler and it lies on the surface. Thank you.
insertBefore()
,appendChild()
andremoveChild()
will help you. htmlweb.ru/java/example/dom_child2.php - Gedweb