Tab through elements using Enter key including select2
问题 I am using following code to tab through form elements using enter key. Problem is that this code skip select2 elements. $('body').on('keydown', 'input, select', function(e) { if (e.key === "Enter") { var self = $(this), form = self.parents('form:eq(0)'), focusable, next; focusable = form.find('input,a,select,button,textarea').filter(':not([disabled]):not([tabindex="-1"]):visible'); next = focusable.eq(focusable.index(this)+1); if (next.length) { next.focus(); } else { //form.submit(); }