I'm working now in a form of multiple choice and i am working with several DOM's at once. Which means i need to work with nodes and their childs.
I was searching the web for a code that erased all nodes from a parent node when i found this link over here:
Best way to remove child nodes
I used and tested it, but when removing all first child nodes, i think it ends up by removing the parent itself or the first child node which doesn't me allow to create child nodes again.
So i readapted the code again, so it sould work a little better in my case:
This way, i erase all childs in a node, and still possilble add again.
I was searching the web for a code that erased all nodes from a parent node when i found this link over here:
Best way to remove child nodes
I used and tested it, but when removing all first child nodes, i think it ends up by removing the parent itself or the first child node which doesn't me allow to create child nodes again.
So i readapted the code again, so it sould work a little better in my case:
Code:
function resetAllNodes(){ if (nodeChangingRadio && nodeChangingRadio.hasChildNodes && nodeChangingRadio.removeChild) { while (nodeChangingRadio.lastChild.hasChildNodes()) { nodeChangingRadio.removeChild(nodeChangingRadio.lastChild); } } }
This way, i erase all childs in a node, and still possilble add again.
Comment