I managed to narrow it down to a very small fiddle:
https://jsfiddle.net/wn7aLf3o/4/
Basically when you click on 'append' it should add an "X" to the textarea. That works great, until I decide to focus the textarea and type some stuff manually. Then I can't append X anymore.
Tested in Chrome and Firefox. What am I doing wrong?
HTML:
<div id="append">append</div>
<textarea id="text"></textarea>
JQuery:
$(function(){
$(document).on('click', '#append', function(){
$('#text').append(" X");
});
});