i have textarea in text pieces (stored on each data-code attribute) appended when clicking on specific div:
$(document).on('click', '.extraspanel .contentvars div', function(e){ varcode = $('.active').attr('data-code'); vartext=$(document).find('textarea').val(); $(document).find('textarea').val(vartext+varcode); checkcounter(e); }); once .contenvars div clicked, data-code value added whatever typed on textarea, , keep typing user must click again on textarea.
i user keep typing after importing pieces of text widthout needing click on it, cursor remains on last position, after last imported character (as if have pasted it).
i have tried adding e.preventdefault; @ end of function, no possitive result.
if you're using jquery, can try .focus()
jquery('textarea').focus();
Comments
Post a Comment