Hi list,<div><br></div><div>I've been wrecking my brains all morning long trying to get to reference the selected text in a textArea by using javascript or whatever means.</div><div><br></div><div>So long, I've found a couple of snippets that should do the job, for example:</div>
<div><br></div><div><div>function getFocusedTextArea() {</div><div> var textareas = document.getElementsByTagName(“textarea”);</div><div> for(var i=0; i lessthan textareas.length; i++) {</div><div> var ta = textareas.item(i);</div>
<div> if (window.getComputedStyle(ta, null).zIndex == 57) {</div><div> return ta;</div><div> }</div><div> }</div><div>}</div></div><div><br></div><div>The problem is that I don't know how to store the value returned by getFocusedTextArea() into a variable inside a component. I'd like something similar to:</div>
<div><br></div><div>html submitButton</div><div> onClick: (html doSomethingMagicInJavascript:</div><div> [aString := html andSomethingElseMagic: 'getFocusedTextArea();']);</div><div> with: 'Get the selected text magically'.</div>
<div><br></div><div>Is there such thing?</div><div><br></div><div>Thanks!</div><div><br></div><div>Bernat Romagosa.</div>