code: function(event) {
      var inputs = $(event.target).parents("form").eq(0).find(":input:visible");
      var inputIndex = inputs.index(event.target);
      // If at end of focusable elements return false, if not move forward one.
      if (inputIndex == inputs.length - 1) {
        // return false on last form input so we know to let the form submit.
        return false
      } else {inputs[inputIndex + 1].focus();}
    }
docs: Move tab index forward one input inside the form an event originates.