回车换行

$('main').on('click','.btn-add',function(){
if($('#createorder')){
$('input.form-control ').keydown(function () {
if(event.keyCode==13) {
var inputs = $("#createorder input.form-control");//得到所有input对象
for (var i = 0; i < inputs.length; i++) {
// 如果是最后一个,则回到第一个
if (i == (inputs.length - 1)) {
inputs[0].focus();
break;
} else if (this == inputs[i]) {
inputs[i + 1].focus();
break;
}
}
}
})
}
posted @ 2018-06-27 20:07  笨笨!  阅读(126)  评论(0编辑  收藏  举报