Format currently selected text script
I'd like to be able to select some of the text in a field, and then click a button to change the text colour to Red.
Something like the answer to this post would be great
However, when I click on the button, the selection size goes to zero and the position goes to the end of the selection.
For instance, if I had text of 100 characters and selected from position 25 with a size of 20; when I click the button it will set the position to 45 and the size to zero, and nothing gets formatted!
How do I keep the selection active while pressing a button?
Never mind, I just needed to set the start and size as variables first.
I now use: