Fix DOM element removal in order to be compatible with IE8

According to javascript documentation it seems that the element.remove() method does not exist