TypeError thrown

Argument 1 passed to DOMNode::removeChild() must be an instance of DOMNode, null given