私はユーザーが入力に1文字を入力し、入力フィールドにJUMPを入力できるようにしようとしています。jQueryは次の入力フィールドにジャンプします
これは、このように動作します:https://jsfiddle.net/ej9tvosj/1/
しかし、私はdiv要素内の入力を入れると、機能が働いて停止します。
https://jsfiddle.net/ej9tvosj/2/
動作しません。私のコードは動作しますが、HTMLの一部が異なっているものと同じです。
$(document).on('input', '.inps', function(event) {
$(this).attr('type', 'tell');
function showpanel() {
$('.inps').attr('type', 'password');
$(this).attr('type', 'tell');
}
// use setTimeout() to execute
setTimeout(showpanel, 1000);
// check for hyphen
var myLength = $(this).val().trim().length;
if (myLength == 1) {
$(this).next('.inps').focus();
$(this).next('.inps').val('');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="form-group">
<label for="inps">enter number</label>
<br>
<div class="split4">
<input type="tell" class="form-control inps" maxlength="1">
</div>
<div class="split4">
<input type="tell" class="form-control inps" maxlength="1">
</div>
<div class="split4">
<input type="tell" class="form-control inps" maxlength="1">
</div>
<div class="split4">
<input type="tell" class="form-control inps" maxlength="1">
</div>
</div>
誰かがこの問題について助言してもらえますか?
あなたが簡単に追加することができますSOのコードスニペット。私はあなたのためにそれを変更しましたが、次回はできるだけスニペットを挿入することを忘れないでください。 – quirimmo