Skip to content

Commit

Permalink
#4842 - query input in question element
Browse files Browse the repository at this point in the history
  • Loading branch information
novikov82 committed Sep 28, 2023
1 parent 404fe2c commit 4fe8dcc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/question_text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class QuestionTextModel extends QuestionTextBase {
private minValueRunner: ExpressionRunner;
private maxValueRunner: ExpressionRunner;
private maskInstance: any;
private element: HTMLElement;
private input: HTMLInputElement;
constructor(name: string) {
super(name);
this.createLocalizableString("minErrorText", this, true, "minError");
Expand Down Expand Up @@ -473,7 +473,7 @@ export class QuestionTextModel extends QuestionTextBase {
@property() mask: string;
private updateMaskInstance() {
if (!this.maskInstance) {
this.maskInstance = new IMask.InputMask(this.element, { mask: this.mask });
this.maskInstance = new IMask.InputMask(this.input, { mask: this.mask });
} else {
this.maskInstance.updateOptions({ mask: this.mask });
}
Expand All @@ -484,7 +484,7 @@ export class QuestionTextModel extends QuestionTextBase {
}
public afterRenderQuestionElement(el: HTMLElement) {
if (!!el) {
this.element = el;
this.input = el instanceof HTMLInputElement ? el : el.querySelector("input");
if (this.mask) this.updateMaskInstance();
}
super.afterRenderQuestionElement(el);
Expand Down

0 comments on commit 4fe8dcc

Please sign in to comment.