首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

回车enter顶替tab切换元素

2012-09-24 
回车enter代替tab切换元素$(function() {$(input).keypress(function(e) {if (e.which 13) {var tbi

回车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

热点排行