I want to insert text in textarea at cursor position if cursor is placed else text should be appended at the end of existing text in IE.
I have used this function which is working fine in mozilla but not in ie where its appending at the starting position of existing text.
function insertAtCursor(text) {
var field = document.frmMain.Expression;
if (document.selection) {
field.focus();
sel = document.selection.createRange();
sel.text = text;
}
}
I want to append text at the end of existing text in ie if cursor is not placed.