Ram pressure stripping the hot gaseous haloes of galaxies in groups and clusters