I'm traveling soon between two cities in mainland Denmark. According to the local route planner (https://www.rejseplanen.dk/), the best route is by bus with 3-4 transfers. Do I have to buy ticket beforehand or can I buy an anonymous rejsekort (https://www.rejsekort.dk/Bestil/Rejsekort-anonymt) and pay as I go. I'd prefer to have my route planned and paid before going to Denmark.
For most buses known by rejseplanen you can't buy a ticket beforehand.
Personally I don't like long journeys by bus, so I might not have noticed it if rejseplanen suggested a stretch with a bus for which it was possible to buy a ticket beforehand. I also don't know if those buses even accept rejsekort. So you might not have the choice you present, but if you share more about your journey, someone might say something more specific.
Living in Denmark I have a personal (non-anonymous) rejsekort, but I have read that not many places sell the anonymous version, so remember to have a plan for where to buy one, but it probably is the wise choice (if rejsekort is even an option).
I'd prefer to have my route planned and paid before going to Denmark.
If your route is solely with Midttrafik, they sell tickets online, both one day and zone tickets: https://webshop.midttrafik.dk/
For some routes it is possible to add a short train trip (that you just don't use) in the start or end of your trip so it becomes possible to buy from DSB: https://www.dsb.dk/en/