Hi list,<div><br></div><div>I&#39;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&#39;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&#39;t know how to store the value returned by getFocusedTextArea() into a variable inside a component. I&#39;d like something similar to:</div>

<div><br></div><div>html submitButton</div><div>   onClick: (html doSomethingMagicInJavascript:</div><div>       [aString := html andSomethingElseMagic: &#39;getFocusedTextArea();&#39;]);</div><div>   with: &#39;Get the selected text magically&#39;.</div>

<div><br></div><div>Is there such thing?</div><div><br></div><div>Thanks!</div><div><br></div><div>Bernat Romagosa.</div>