diff --git a/packages/survey-core/src/survey.ts b/packages/survey-core/src/survey.ts index b3dcefa43a..35c3c4db67 100644 --- a/packages/survey-core/src/survey.ts +++ b/packages/survey-core/src/survey.ts @@ -5333,7 +5333,7 @@ export class SurveyModel extends SurveyElementCore if (this.onAfterRenderQuestionInput.isEmpty) return; let id = (question).inputId; const { root } = settings.environment; - if (!!id && htmlElement.id !== id && typeof root !== "undefined") { + if (!!id && (!htmlElement || htmlElement.id !== id) && typeof root !== "undefined") { let el = root.getElementById(id); if (!!el) { htmlElement = el;