I\'m working on a BBCode editor and here is the code:
var txtarea = document.getElementById(\"editor_area\"); function boldText() {
if you are using jquery you can do it like this.
$('textarea').prop('selectionEnd', 13);