delete a document in cd code example
Example: javascript remove element by id
//removing element by ID
var element = document.getElementById("myElementID");
element.parentNode.removeChild(element);
//removing element by ID
var element = document.getElementById("myElementID");
element.parentNode.removeChild(element);