JQuery 输入掩码在焦点移位选项卡上



我正在尝试使用robin herbots的JQuery库Inputmask。它似乎有一个功能,即当您按 Tab 键进入文本框时,它会存储和使用文本框的最后一个已知插入符号,它将插入符号设置为该位置。我不想要这个功能。我希望有一个默认功能,当您按 Tab 键进入文本框时,将选择整个文本。我尝试将输入的 onfocus 事件设置为 this.select((,但似乎在该事件触发后库覆盖或移动插入符号。

以下是我尝试使用的一些选项。我会猜测位置CaretOnTab会根据自述文件完全完成我想要的,但它似乎没有任何效果。

$input.inputmask({
alias: 'currency',
integerDigits: 12,
digits: 2,
autoGroup: true,
groupSeparator: ',',
autoUnmask: true,
positionCaretOnTab: false,
numericInput: false,
positionCaretOnClick: "none"
}); 

我认为你的代码正在工作不是吗?

$("#example2").inputmask({
alias: 'currency',
integerDigits: 12,
digits: 2,
autoGroup: true,
groupSeparator: ',',
autoUnmask: true,
positionCaretOnTab: false,
numericInput: false,
positionCaretOnClick: "none"
});
<script src="https://code.jquery.com/jquery-1.10.0.min.js"></script>
<script src="https://rawgit.com/RobinHerbots/Inputmask/4.x/dist/jquery.inputmask.bundle.js"></script>
<input type="text"  id="example1"/>
<input type="text"  id="example2"/>

相关内容

最新更新