I'm using ace editor. Sometimes, and I can not say exactly when (I put the text editor in ajax), Of the text cursor moves to the end of the line only there to write. Only if I refresh the page again, it works out.
Here is the code:
var ace_editor = null;
// Than I call to ajax to get the content of the ace editor
ace_editor = ace.edit("editbox");
ace_editor.setTheme("ace/theme/eclipse");
ace_editor.getSession().setMode("ace/mode/html");
ace_editor.getSession().setValue(ParseResponseRules(xmlhttp.responseText));
Try:
ace_editor.setValue(ParseResponseRules(xmlhttp.responseText), -1);
instead of:
ace_editor.getSession().setValue(ParseResponseRules(xmlhttp.responseText));
The second parameter explained: undefined or 0 is selectAll, -1 is at the document start, and 1 is at the end