Preheat the oven to 350°F.
Cook the onions in 2 tablespoons of butter in an ovenproof skillet over low heat until tender but not brown. Stir in the jalapeños and garlic and cook for 2 minutes, stirring constantly. Add the corn, salt, and pepper and mix well. Continue cooking for 1 minute, stirring frequently.
Transfer ⅔ of the corn mixture into a bowl. Stir the remaining 2 tablespoons of butter into the rest of the corn mixture in the skillet, and spread it out to cover the bottom of the skillet.
Toss the Monterey Jack cheese and Cheddar cheese in a bowl.
Sprinkle ⅓ of the cheese mixture over the corn mixture left in the skillet and then spoon ½ of the remaining corn mixture (from the bowl) on top of the cheese. Sprinkle with ½ of the remaining cheese mixture and top with the remaining corn mixture from the bowl.
Whisk the eggs, milk, salt, and pepper in a bowl until blended and pour over the prepared layers. Sprinkle with the rest of the cheese. Bake for 25 minutes or until puffed and brown. Serve hot or at room temperature.