Salt draws water out of the cells by osmosis, and when that happens decides what the onion does next.
Salt early and the onions release water into the pan. That water keeps the temperature at boiling point until it evaporates, so the onions soften and sweat rather than brown. Good for a base where you want them translucent and sweet.
Salt late and the surface stays drier for longer, so the pan gets hotter sooner and you get colour and caramelisation rather than softening.
Neither is correct in general. Salting early for a soffritto and late for browned onions on a burger are both right for what they are after.