I want to focus into inputbox
after PrimeNg autocomplete
onSelect
event click.
<p-autoComplete [(ngModel)]="itemIdAuto" name="itemIdAuto1" #itemIdAuto1="ngModel" size="15"
[suggestions]="filteredItemIdAutoSingle" (completeMethod)= "itemIdAutoComplete($event)" field="name"
(onSelect)="itemOnSelect(itemIdAuto)" placeholder= "Select Item Name" [minLength]="1"></p-autoComplete>
<input type="number" autocomplete="off" style="font-size:12px" class="form-control" name="qty"
[(ngModel)]="model.qty" #qty="ngModel">
TypeScript:
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
export class GridFormComponent implements OnInit {
constructor() {
}
ngOnInit() {
}
@ViewChild('aForm') aForm: ElementRef;
itemOnSelect(item) {
this.aForm.nativeElement['qty'].focus();
}
}
I am adding another answer as per your last comment look at below link and let me know if you found any issue.
one more thing to focus on element i have used jquery so please kindly keep note it.
thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.