Input Cursor Position issue

Hi,

I’m trying to get the cursor position using the below code,

<ion-textarea #myInput (click)="getPos(myInput);" (ionChange)="getPos(myInput);" [(ngModel)]="emailTemplate" type="text"></ion-textarea>
    
getPos(myInput)
  {
    if (myInput.selectionStart || myInput.selectionStart == '0') {
       console.log(myInput.selectionStart);
    }
    else
    {
        console.log("fail");
    }
  }

Can anyone please tell me why my cursor position keeps returning as undefined?

Thanks

3 Likes

Did you ever get this to work?

3 Likes