jquery 专注于数字输入不会触发移动设备的数字键盘

jquery focusing to number input not trigger the num keyboard for mobile

我的页面一加载,我就让用户输入第一个数字到 otp。当我通过 jquery 执行此操作时,默认情况下 num 键盘不是 visible.later 我手动如果我专注,我得到 num 键盘。如何解决这个问题?

这是我的代码:

setTimeout(function(){
                Ember.$('.digit0').focus(); 
            }, 100 );

我的html:

{{#each cardDigitField as  |field index| }}
                 <input type="number" tabindex="{{count}}" min="0" max="9" maxlength="1" value='' 
                    pattern="[0-9]*" inputmode="numeric"
                    onKeyUp={{action "numberEntered" index }} 
                    onKeyPress={{action "numberInit" }}
                    onPaste={{action "numberPaste" }} class="digit{{index}}" > 
                    {{#if requiredHyphen}}
                        {{add-hyphen index 4 cardDigitField.length}}
                    {{/if}}
            {{/each}}

一般来说setTimeout和Ember的runloop配合起来不是很好。如果你在你的组件中使用 afterRender 钩子然后你的 jQuery 你有更好的成功吗?