Files
old.martials.no/src/utils/dom.ts
Martin Berg Alstad 0528645838 Updated dependencies.
Added prettier and formatted.
Fixed bug causing back button to not show at all times.
2024-02-25 00:18:02 +01:00

10 lines
311 B
TypeScript

/**
* Get an element by id
* @param id The id of the element
* @type T The type of the HTMLElement
* @returns The element with the given id, or null if it doesn't exist
*/
export function getElementById<T extends HTMLElement = HTMLElement>(id: string): T | null {
return <T>document.getElementById(id)
}