我是靠谱客的博主 执着芝麻,这篇文章主要介绍Jquery 实现input回车时跳转到下一个input元素,现在分享给大家,希望可以做个参考。

 
 
/**
* 回车时跳转到下一个元素
* @Author
HTL
* @DateTime
2016-12-30T11:33:25+0800
* @param
{[type]}
$input [INPUT 元素列表]
* @return
{[type]}
[description]
*/
function keydown_to_tab($input){
if(!$input) $input = $('input:text:not(:disabled)');
$input.bind("keydown", function(e) {
var n = $input.length;
if (e.which == 13){
e.preventDefault(); //Skip default behavior of the enter key
var nextIndex = $input.index(this) + 1;
if(nextIndex < n)
$input[nextIndex].focus();
else
$input[nextIndex-1].blur();
}
});
}

 

参考:
how-to-set-focus-on-next-textbox-on



From WizNote



最后

以上就是执着芝麻最近收集整理的关于Jquery 实现input回车时跳转到下一个input元素的全部内容,更多相关Jquery内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(125)

评论列表共有 0 条评论

立即
投稿
返回
顶部