function setIndexLastWord(inputId) { var tar = document.getElementById(inputId); if(tar.setSelectionRange) { tar.setSelectionRange(tar.value.length , tar.value.length); } else { var range = tar.createTextRange(); range.moveStart("character",tar.value.length); range.moveEnd("character",tar.value.length); range.select(); } tar.focus(); }
获得焦点后焦点定位到最后一个字符
最新推荐文章于 2019-03-27 19:45:50 发布