I have written below code to set focus to the end of text in the textbox :
var textbox = document.getElementById('txtFilter');
textbox.focus();
textbox.value = textbox.value;
But I am facing a problem here. When i keep typing fastly, newly typed characters are not appearing and it is displaying the old value again and again. So I have to wait after pressing each key, then it works fine.
I found another piece of code to achieve this:
if (textbox.createTextRange) {
var FieldRange = textbox.createTextRange();
FieldRange.moveStart('character', textbox.value.length);
FieldRange.collapse();
FieldRange.select();
return false;
}
But when I tried this, I am getting error - Could not complete the operation due to error 800a025e sometimes. Please help me. Any help will be appreciated.