扫码关注官方订阅号
<script>$(document).ready(function(){
$("#testp :input[class='testClass']").keydown(function(e) { var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode; if (keyCode == 39){
keyCode == 9;
} if (keyCode == 13){
keyCode == 9; var ab = $(this).attr("tagName"); var bc = $(this).parent().next().children().attr("tagName"); var inputs = $("#testp :input[class='testClass']"); var selects = $("#testp select"); var idx = inputs.index(this); var idx2 = selects.index(this); //console.log(selects.length) if (idx == inputs.length - 1) { return false; } else { if (bc == "INPUT") { inputs[idx + 1].focus(); console.log( ab+ ":"+bc) } else if(bc == "SELECT") { $(this).parent().next().children().focus().css("border","1px 127solid red");
$("#testp select").keydown(function(e){var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;if (keyCode == 13){$(this).parent().next().children().focus();}})
}else{ inputs[idx + 1].focus(); } } //inputs[idx + 1].focus(); return false;
} });});</script>
结贴谢谢大家
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
<script>
$(document).ready(function(){
$("#testp :input[class='testClass']").keydown(function(e) {
var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
if (keyCode == 39){
}
if (keyCode == 13){
$("#testp select").keydown(function(e){
var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
if (keyCode == 13){
$(this).parent().next().children().focus();
}
})
}
});
});
</script>
结贴
谢谢大家