I have a problem setting focus in the next textbox am using the easy UI plugin. I know there is an option do this with MaskedBox
<input class="easyui-maskedbox" mask="(999) 999-9999" style="width:100%">
but I want to do this with the easyui-textbox can anyone help me do this functionally.
HTML:
<div class="otp-textbox">
<input type="text" class="easyui-textbox" />
<input type="text" class="easyui-textbox" />
<input type="text" class="easyui-textbox" />
</div>
Generate the HTML in DOM
<div class="otp-textbox">
<input type="text" class="easyui-textbox textbox-f" style="display: none;">
<span class="textbox">
<input id="_easyui_textbox_input20" type="text" class="textbox-text validatebox-text textbox-prompt"
autocomplete="off" tabindex="" placeholder="" maxlength="1"
style="margin: 0px; padding-top: 0px; padding-bottom: 0px; height: 28px; line-height: 28px; width: 182.4px;">
<input type="hidden" class="textbox-value" value="">
</span>
<input type="text" class="easyui-textbox textbox-f" style="display: none;">
<span class="textbox">
<input id="_easyui_textbox_input21" type="text" class="textbox-text validatebox-text textbox-prompt"
autocomplete="off" tabindex="" placeholder="" maxlength="1"
style="margin: 0px; padding-top: 0px; padding-bottom: 0px; height: 28px; line-height: 28px; width: 182.4px;">
<input type="hidden" class="textbox-value" value="">
</span>
<input type="text" class="easyui-textbox textbox-f" style="display: none;">
<span class="textbox">
<input id="_easyui_textbox_input22" type="text" class="textbox-text validatebox-text textbox-prompt"
autocomplete="off" tabindex="" placeholder="" maxlength="1"
style="margin: 0px; padding-top: 0px; padding-bottom: 0px; height: 28px; line-height: 28px; width: 182.4px;">
<input type="hidden" class="textbox-value" value="">
</span>
</div>
JS
$(".otp-textbox .textbox").find('input.textbox-text').each(function () {
$(this).attr('maxlength', 1);
$(this).on('keyup', function (e) {
if (this.value.length == this.maxLength) {
$(this).next().focus();
}
});
});
Can you try this:
Instad of this: