diff --git a/web_src/js/features/comp/WebHookEditor.js b/web_src/js/features/comp/WebHookEditor.js index 65d030caad67a..a3dca03caae96 100644 --- a/web_src/js/features/comp/WebHookEditor.js +++ b/web_src/js/features/comp/WebHookEditor.js @@ -22,13 +22,16 @@ export function initCompWebHookEditor() { }); } - const updateContentType = function () { - const visible = document.getElementById('http_method')?.value === 'POST'; - toggleElem(document.getElementById('content_type')?.parentNode.parentNode, visible); - }; - updateContentType(); + const httpMethodInput = document.getElementById('http_method'); + if (httpMethodInput) { + const updateContentType = function () { + const visible = httpMethodInput.value === 'POST'; + toggleElem(document.getElementById('content_type')?.parentNode.parentNode, visible); + }; + updateContentType(); - document.getElementById('http_method')?.addEventListener('change', updateContentType); + httpMethodInput.addEventListener('change', updateContentType); + } // Test delivery document.getElementById('test-delivery')?.addEventListener('click', async function () {