When i was set focus on HTML control after set data,working fine in firefox.
But in IE 10 it focus on starting text, But i want focus on text end.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amitesh VermaPosted Aug 3, 2015, 7:14 AM
$.fn.focusTextToEnd = function(){
this.focus();
var $thisVal = this.val();
this.val('').val($thisVal);
return this;
}
}(jQuery));
var inputField = document.getElementById(id);
if (inputField != null && inputField.value.length != 0){
if (inputField.createTextRange){
var FieldRange = inputField.createTextRange();
FieldRange.moveStart('character',inputField.value.length);
FieldRange.collapse();
FieldRange.select();
}else if (inputField.selectionStart || inputField.selectionStart == '0') {
var elemLen = inputField.value.length;
inputField.selectionStart = elemLen;
inputField.selectionEnd = elemLen;
inputField.focus();
}
}else{
inputField.focus();
}
}
Maria JohnsonPosted Aug 3, 2015, 8:13 AM
Rajeesh MenothPosted Aug 3, 2015, 7:19 AM
Maria JohnsonPosted Aug 3, 2015, 7:09 AM
Amitesh VermaPosted Aug 3, 2015, 7:04 AM