var obj = document.getElementById('textarea_id'); var range = obj.selection.createRange(); range.moveStart('character', selStart); range.moveEnd('character', selEnd); range.select();