hi, im trying to remove LI from one UL and adding it in another. my code works fine in FF but not in IE. please can u tell me what im doing wrong. the problem is that it does not remove the node. function removeNode(nodeId) { var ul = document.getElementById("boxes"); var myLi = document.getElementById(nodeId); myLi.removeChild(document.getElementById("img_"+nodeId)); myLi.removeChild(document.getElementById("br_"+nodeId)); ul.removeChild(document.getElementById(nodeId)); var topUl = document.getElementById("boxes1"); myLi.className = "box1"; myLi.onclick = function(){moveChild(nodeId)}; topUl.appendChild(myLi); }
This might not be the problem but replace myLi.onclick = function(){moveChild(nodeId)}; Code (markup): with myLi.onclick = function(){moveChild(nodeId);}; Code (markup): or myLi.onclick = function(){ moveChild(nodeId); }; Code (markup):
I'm not a JavaScript expert so this is probably correct but it just seems weird to me: var myLi = document.getElementById(nodeId); --- ul.removeChild(document.getElementById(nodeId)); --- myLi.className = "box1"; myLi.onclick = function(){moveChild(nodeId)}; topUl.appendChild(myLi); HTML: The child you removed seems to be the exact same as myLi and if you've removed it from its parent, does it actually still exist? Just wondering since you were able to set the classname and such of it later.