读书人

回车enter顶替tab切换元素

发布时间: 2012-09-24 13:49:41 作者: rapoo

回车enter代替tab切换元素

$(function() {$("input").keypress(function(e) {if (e.which == 13) {var tbi =$(this).attr('tabIndex')$('input').each(function(){var dif = Number($(this).attr('tabIndex'))-Number(tbi);if(dif==1){this.focus();this.select();return false;}})}});});
?需要对页面元素指定tabIndex属性,且按顺序递加1

读书人网 >Web前端

热点推荐