Surfactant adsorption at the air-water interface is critical to many industrial processes but its dependence on salt ions is still poorly understood. Here, we investigate the adsorption of sodium dodecanoate onto the air-water interface using model saline waters of Li+ or Cs+ at pH values 8 and 11. Both cations enhance the surfactant adsorption, as expected, but their largest effects on the adsorption also depend on pH. Specifically, surface tension measurements, sum-frequency generation spectroscopy, and microelectrophoresis show that small (hard) Li+ enhances the surfactant adsorption more than large (soft) Cs+ at pH 11. This effect is fully reversed at pH 8. We argue that this salting-up (increasing adsorption) reversal is attributable to the conversion of the neutralized carboxylic (-COOH) headgroup at pH 8 into the charged carboxylate (-COO-) headgroup at pH 11, which, respectively, interact with Cs+ and Li+ favorably. Molecular dynamics simulation shows that the affinity of Cs+ to the interface is decreased and eventually overtaken by Li+ as the carboxylic groups are deprotonated. This study highlights the importance of the charge and size of salt ions in selecting surfactants and electrolytes for industrial applications.