DOM Changes Javascript

I was trying to make some DOM changes. When I try to add or update my DOM it is possible thru this small code snippet

$(abc).each(function() {    
    if (($(this).attr("id") != "SceneOne")) {
        var txt=$($.parseXML(xml)).find(shashin).children().appendTo(thashin);
        console.log(txt);
    }
});   

and for deleting some parts of the DOM structure I use

var targeti = $(this).find("targetid").text();
var el=document.getElementById(targeti);
el.parentNode.removeChild(el);  

But then, When I use the code for my server side JS using Node. The add and update functions work perfectly but not the delete funciton. I tried using this as well from the Jquery library , but that does not work either.

any ideas why?