jQuery: 在網頁上讓Enter鍵變成Tab的行為
$("input, select").not( $(":button") ).keypress(function (evt) {
if (evt.keyCode == 13) {
if ($(this).attr("type") !== 'submit'){
var fields = $(this).parents('form:eq(0),body').find('button, input, textarea, select');
var index = fields.index( this );
if ( index > -1 && ( index + 1 ) < fields.length ) {
fields.eq( index + 1 ).focus();
}
$(this).blur();
return false;
}
}
});


0 Responses to "jQuery: 在網頁上讓Enter鍵變成Tab的行為"
留下您的意見: