focusTextEnd (e: Event): void {
let o: any = e.target;
if (o.setSelectionRange) { //W3C
setTimeout (function () {
o.setSelectionRange(o.value.length, o.value.length);
o.focus();
},0);
} else if (o.createTextRange){ //IE
var textRange = o.createTextRange();
textRange.moveStart("character",o.value.length);
textRange.moveEnd("character",0);
textRange.select();
}
}
记录文本光标显示在最后的代码
最新推荐文章于 2024-08-13 22:07:58 发布