looking for some solutions? You are welcome.

SOLVED: Updating innerHTML value changes the cursor position to starting point

sachin:

HTML:

<h1 contenteditable="true" [innerHTML]="myData['name']" (click) = "myFunc($event)"></h1>

TS:

myData = {name: "test"};

myFunc ($event) {
     changedVal = $event.target.innerHTML;
     myData['name'] = changedVal; //this will update the innerHTML of h1
}

While editing the dietable h1 element value, every time cursor is moving to the starting point



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent