0

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

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

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

1 回答 1

0

我认为您的代码正在运行不是吗?

$("#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"/>

于 2017-07-21T22:02:43.127 回答