0

私はjQueryのマスクされた入力プラグインを使用しています.フィールドのフォーカスを取得してフォーカス(ぼかし、フォーカス)をカーソルを最初に戻すと、カーソルを常に最後に残す必要がありますが、できません。

$('#id_origin_zipcode').bind('focus', $.proxy(this.moveCursorToEnd, this));

moveCursorToEnd: function(e){
    var value = $('#id_origin_zipcode').val();
    $('#id_origin_zipcode').val(value);

},
4

1 に答える 1

2

selectionStart と selectionEnd を長さの値に設定できます。例えば

<input type="text" onFocus="this.selectionStart = this.selectionEnd = this.value.length;" />
于 2014-04-11T19:16:13.433 に答える