Javascript 将光标移动到带有jquery屏蔽输入的结束输入
我使用的是jQuery屏蔽输入插件,当我获取字段的焦点并返回焦点(模糊,焦点)时,光标会返回到开头,需要始终将光标保留在末尾,但我不能Javascript 将光标移动到带有jquery屏蔽输入的结束输入,javascript,jquery,input,maskedinput,Javascript,Jquery,Input,Maskedinput,我使用的是jQuery屏蔽输入插件,当我获取字段的焦点并返回焦点(模糊,焦点)时,光标会返回到开头,需要始终将光标保留在末尾,但我不能 $('#id_origin_zipcode').bind('focus', $.proxy(this.moveCursorToEnd, this)); moveCursorToEnd: function(e){ var value = $('#id_origin_zipcode').val(); $('#id_origin_zipcode').
$('#id_origin_zipcode').bind('focus', $.proxy(this.moveCursorToEnd, this));
moveCursorToEnd: function(e){
var value = $('#id_origin_zipcode').val();
$('#id_origin_zipcode').val(value);
},
您可以将selectionStart和selectionEnd设置为值长度。e、 g
<input type="text" onFocus="this.selectionStart = this.selectionEnd = this.value.length;" />
您能展示一下您目前拥有的代码吗?这将非常有帮助。