I\'m working on a BBCode editor and here is the code:
var txtarea = document.getElementById(\"editor_area\"); function boldText() {
Through JQuery:
var cursorPos = $('#textarea').prop('selectionStart'); $('#textarea').prop('selectionEnd',cursorPos-2);