I need to change the text color from an selected text in a textarea, when I click on a Button.
My first try:
document.getSelectedText(document.getElementById('test22')).style.color = '#0F0';
My secound try:
document.getSelectedText((test22.value).substring(test22.selectionStart, test22.selectionEnd)).style.color = '#0F0';
HTML code:
<textarea name="area1" cols="40" id="test22"></textarea>
<button onclick="test();">CLICK</button>
Thank you! ;)