From this post I found and answer on how to position the cursor in a textarea.
I am creating a jquery chat and I wanted to create a simple html textarea, having a div infront of the textarea displying the html contained in the textarea.
Mark posted the following script:
$.fn.selectRange = function(start, end) {
return this.each(function() {
if(this.setSelectionRange) {
this.focus();
this.setSelectionRange(start, end);
} else if(this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', start);
range.select();
}
});
};
Witch works fine, but my problem is, how do I find the end position in the div of the html displayed there?