I am trying to set the cursor position in a textarea using 'selectionStart' property. But while executing the line "element.selectionStart = 6", IE [9/10/11] gives an error "Could not complete the operation due to error 800a025e".
if (typeof element.selectionStart !== 'undefined') {
element.selectionStart = aCursorPosition;
element.selectionEnd = aCursorPosition;
}
I tried to put a debug point right before this line and tried to add a watch expression which will set the 'selectionStart' to '0' but event this results the same error.
The textarea in concern is loaded view Ajax response. The same piece of code works fine when the textarea is rendered normally.
Any clue how to solve it?