Heat 2 teaspoons butter in a frying pan. When it gets medium hot, add in the sliced onions along with a pinch of salt. Cook the onions on medium heat for 7-10 minutes or until they get lightly caramelized and golden brown. Save ⅓ of the caramelized onions for later.
Preheat your oven to 400F/200C.
Grease your baking dish with a teaspoon of soft butter all over the bottom and sides. I used a 7"*11" baking dish.
Wash the potatoes well and then dry them. I prefer not to peel them but you can if you like. Slice the potatoes really thin (about ⅛") either using a mandolin or a sharp knife.
Arrange small portions of the sliced potatoes in the baking dish at a time, fanning them out a little so that they can bake evenly. You should have a thin layer of potatoes at the bottom of the baking dish. Now layer the caramelized onions and some some sliced jalapenos (if you like spicy food). Pour over about ⅓ of the cream mixture over the top.
Continue fanning and layering the remaining potatoes over the top of the onion jalapeno layer. Do this until the baking dish is completely filled with the sliced potatoes. Now pour over the remaining cream mixture evenly over the potatoes.
Sprinkle the cheddar cheese evenly over the potatoes and then cover the baking dish with a piece of aluminum foil. Place the baking dish on a bigger baking tray/cookie sheet to avoid spills in your oven.
Bake covered at 400F/200C for about 1 hour and 20 minutes.
By now the potatoes should be bubbling and almost cooked through. Now, take off the foil and sprinkle parmesan cheese all over the potatoes.
Return the dish to the oven and bake uncovered for about 20 minutes or until the potatoes are golden brown and crispy on top.