My input element initially contains the value 'abcdefghijklmnopqrstuvwxyz'
I utilized ref
to highlight the characters from 'n' to 'z'
inputRef.current.setSelectionRange(18, 26);
This code snippet results in the following:
https://i.sstatic.net/cTFQ1.png
How can I dynamically change the input value to this instead?
https://i.sstatic.net/7aPna.png
Further information:
If I switch to another tab and then return to the tab with the input field, it displays the desired outcome. However, I am unsure how to achieve this using code.