I've hit a snag trying to manipulate text in a textArea. Although there's some past articles on this topic, nothing on how to resolve my problem. Hope you can help. Ok...
I can use the document.selection; object to get the highlighted text in a textArea, and to then pass it into a TextRange. The problem I have is however, if nothing is highlighted the manipulated text is inserted outside of the textArea; into the document flow. Here's the core script:
That's fine, it updates the TextArea with the highlighted name and age. However, if no highlight occurs the age appears next to the TextArea. Any suggestions to force the age to be inserted wherever the insertion point is inside the TextArea?HTML Code:var txtSel = document.selection; var txtRange = txtSel.createRange(); var age = "24"; txtRange = txtRange + " " + age;




Reply With Quote
