2018-07-05 19:36:02 +02:00
|
|
|
import { getElementById } from "./getElementById";
|
2018-07-08 05:42:58 +02:00
|
|
|
import { removeElement } from "./removeElement";
|
2018-07-05 19:36:02 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Given its id, this function removes an element AND its children
|
|
|
|
* @param id The HTML identifier to search for and remove.
|
|
|
|
*/
|
2021-05-01 09:17:31 +02:00
|
|
|
export function removeElementById(id: string): void {
|
2018-07-05 19:36:02 +02:00
|
|
|
try {
|
|
|
|
const elem: HTMLElement = getElementById(id);
|
2018-07-08 05:42:58 +02:00
|
|
|
removeElement(elem);
|
2018-07-05 19:36:02 +02:00
|
|
|
} catch (e) {
|
|
|
|
// Probably should log this as we're trying to remove elements that don't exist.
|
|
|
|
}
|
|
|
|
}
|