I found a half-solution that removes both elements first time but removes only second element afterward. I put a form-tag around both div and remove all childs of this form.
<script type='text/javascript'>
function removeChildrenFromNode()
{
var cell = document.getElementById("divForm1");
if (cell.hasChildNodes()){
while (cell.childNodes.length >= 1)
cell.removeChild(cell.firstChild);
}
var cell = document.getElementById("divForm2");
if (cell.hasChildNodes()){
while (cell.childNodes.length >= 1)
cell.removeChild(cell.firstChild);
}
}
</script>
var div1= '<form id="divForm1"><div id="a1"></div></form>';
var div2= '<form id="divForm2"><div id="a2"><button onclick="removeChildrenFromNode();"></div></form>';
does someone know how to modify this to a full-solution? (so it ALWAYS remove both elements).(i need it because i generate these both div dynamically with a button inside document and i need to remove these 2 div afterwards)
thx,
Bookmarks