Pinco, is there a property that shows where the cursor/caret is?
e.g.,
"I am ^ typing"
if I want to be able to insert text at the ^, where the user has put the cursor I need to know what that position is.
I found this on the net but no idea where to begin
function setCaretPosition(elemId, caretPos) {
var elem = document.getElementById(elemId);
if(elem != null) {
if(elem.createTextRange) {
var range = elem.createTextRange();
range.move('character', caretPos);
range.select();
}
else {
if(elem.selectionStart) {
elem.focus();
elem.setSelectionRange(caretPos, caretPos);
}
else
elem.focus();
}
}
}