title: JavaScript IE appendChild() - Unexpected call to method or property access
body: <p>I have been having this problem in IE. I have two divs which I use to drag selected elements from one to another. Lets say I have a child element (also a div) in div1 and some child elements in div2. I call the div2.appendChild() method on child element of div1. It removes the child from div1 and appends it to div2. If I then try to append the child back to div1 I get the following exception "Unexpected call to method or property access" in IE. It is working perfectly in firefox. See below code snippet for the javascript.</p>
  
  <pre><code>function moveSelectedGroupBoxItems(toLocation, grp){
      document.body.className = 'groupBoxDefaultCursor';
      if(groupBoxfromLocation != toLocation){
          if(grp == groupBoxGroup){
              var fromVal = document.getElementById(groupBoxfromLocation);
              var toVal = document.getElementById(toLocation);
  
              var children = fromVal.childNodes;
              for (var i = children.length - 1; i &gt;= 0; i--) {
                  if(children[i].className == 'groupBoxItemSelected'){
                      children[i].childNodes[0].name=toLocation;
                      toVal.appendChild(children[i]);
                  }
              }
          }
      }
      groupBoxfromLocation = '';
      groupBoxGroup = '';
      return false;
  }
  </code></pre>
  
  <p>This basically moves the selected child divs from one parent div to another on dragging.</p>