You should fry onions in butter if you want a richer flavor.
If you want better temperature control and prevention of burning at high heat you should use oil.
When you use butter to fry onions, you should use a high smoke point oil to prevent the butter from burning.
When frying onions, it's best to use cooking oils with high smoke points, such as canola oil and olive oil, which is important for achieving a good fry and caramelization of the onions.
Adding butter to the onion frying process can also result in a rich delicious flavor and add a nice texture and fragrance to the fried onions.
Butter has a lower smoke point than some oils so the butter can burn if it's heated too high.
To avoid the burning you should use a combination of both butter and oil and the oil helps with temperature control and the butter adds flavor.
The best way to fry onions is to heat a 3cm depth of oil in a large saucepan or frying pan over a medium heat until it reaches 160C, or a piece of onion sizzles when you drop it in.
Then fry the onions in batches for 5-8 minutes, stirring regularly until the onions are golden and crispy.
Remove to a plate lined with kitchen paper using a slotted spoon to drain.