【发布时间】:2024-08-20 10:05:02
【问题描述】:
如何通过(单击)事件将焦点设置在输入上?我有这个功能,但我显然错过了一些东西(这里有角度的新手)
sTbState: string = 'invisible';
private element: ElementRef;
toggleSt() {
this.sTbState = (this.sTbState === 'invisible' ? 'visible' : 'invisible');
if (this.sTbState === 'visible') {
(this.element.nativeElement).find('#mobileSearch').focus();
}
}
【问题讨论】:
标签: javascript angular