I want to display written textarea text in another textarea by clicking a third element. So here's the code I'm using at the moment but it shows the written text when you press the textarea:
$(function(){
$('#text').click(function(){
$('#preview').text($(this).val());
});
});
And here's the HTML part:
<textarea id="text"></textarea>
<textarea id="preview"></textarea>
<div id="show-text"></div>
So the idea is to display the text inside textarea#text in textarea#preview when you click div#show-text.
Your problem is that your click event is registered on the textarea. What you're actually looking for is: