diff --git a/scripts/classes/ProcessInputForm/classProcessInputForm.ts b/scripts/classes/ProcessInputForm/classProcessInputForm.ts index 84a7cb6..b0f3744 100644 --- a/scripts/classes/ProcessInputForm/classProcessInputForm.ts +++ b/scripts/classes/ProcessInputForm/classProcessInputForm.ts @@ -57,7 +57,11 @@ export default class classProcessInputForm { * @param {string} value Value that we modify with */ private static setInnerHTML(elementId: string, value: string) { - window.document.getElementById(elementId).innerHTML = value; + const element = window.document.getElementById(elementId); + + if (element && value) { + element.innerHTML = value; + } } /** diff --git a/scripts/classes/ValidText/classValidText.ts b/scripts/classes/ValidText/classValidText.ts index f17d34c..511a63a 100644 --- a/scripts/classes/ValidText/classValidText.ts +++ b/scripts/classes/ValidText/classValidText.ts @@ -23,9 +23,9 @@ export default class classValidText { bilInformasjon !== undefined && bilInformasjon.length === 7 ) { - submitButton.removeAttribute("disabled"); + submitButton?.removeAttribute("disabled"); } else { - submitButton.setAttribute("disabled", "true"); + submitButton?.setAttribute("disabled", "true"); } }; }