Textarea tags
Insert a new text or a input value into a textarea at the cursor position using jquery
by itsneelshah
HTML
<form>
<textarea id="text1" cols="40" rows="3"></textarea>
<textarea id="text2" cols="40" rows="3"></textarea>
<br>
<input type="button" value="one" />
<input type="button" value="two" />
<input type="button" value="three" />
</form>
JavaScript
$('textarea').on('focus', function() {
$('textarea.last-focused').removeClass('last-focused')
$(this).addClass('last-focused');
});
$( 'input[type=button]' ).on('click', function(){
$('textarea.last-focused').html($(this).val())
});