On the optical and near-infrared radial velocity content of M dwarfs