Topic: jquery problems with selected text

I have this

$('#link').bind('click', function() {
var selection = window.getSelection();
if (selection == "") { selection = "text"; }
$('#content').append(""+selection+"");
return false;

---

<a href="#" id="link">text</a>
<textarea id="content" name="content"></textarea>

it works only when I dont click inside the textarea, but when I write on it, the js code doesnt work

Last edited by jtomasrl (2011-07-14 20:01:26)