【发布时间】:2016-03-30 14:41:39
【问题描述】:
我的输入和 setSelectionRange 方法有问题。问题是我在末尾设置了光标位置:
input.setSelectionRange(input.value.length,input.value.length );
光标移动到结尾,但文本保持在同一位置。它适用于 Firefox,但不适用于 Chrome。
var input = document.querySelector("input");
input.onclick = function (){
this.setSelectionRange(this.value.length,this.value.length )
}
<input id="beLowerCase" type="Text" value="______________________________232332" />
【问题讨论】:
-
@Magicprog.fr 和我的例子一样
标签: javascript html