principal0 saidSo potassium is always the go-to solution people first think of. However as pointed out above, spasms can be caused by any electrolyte imbalance. The physiologically important electrolytes are:
Sodium (Na+), potassium (K+), calcium (Ca2+), magnesium (Mg2+), chloride (Cl−), hydrogen phosphate (HPO42−), and hydrogen carbonate (HCO3−)
Sodium, potassium and calcium are the electrolytes primarily associated with muscle contraction. While potassium is important, you could just as easily be getting too little calcium or too little salt.
While many people still associate salt with high blood pressure, that is actually an issue of deep contention since there is no real proof of this assertion. And so many people actually have insufficient dietary salt.
Yes there are other electrolytes, but because sodium nearly always comes with chloride in real food, no one mentions chloride. This is why I suggested milk--it has more electrolytes (sodium, calcium, and potassium, namely) than an electrolyte drink while also supplying protein and carbohydrate. Magnesium can be obtained by having a handful of nuts everyday.
I disagree about salt and high blood pressure. Water follows salt, and since sodium is the extracellular ion, having excess sodium in the diet would mean extracellular volume increases, and therefore, more pressure on artery walls. In America, people who have poor diet choices often consume many processed foods, which are high in sodium, therefore constantly creating this situation of increased blood pressure that from an etiology standpoint is transient and easily rectified by sweating, kidney filtration and urination, and reducing sodium--but because people are loath to make dietary changes that have such effects, they chronically have high blood pressure.
In order of magnitude of blood pressure reduction, however, sodium is the last (least effective) on the list. Increasing potassium intake (fruits, veggies, milk) reduces blood pressure more than sodium reduction alone. What works even better than those is aerobic exercise in the range of 40-70% VO2max, which lay people call the 'fat burn' zone (not the cardio zone). Additionally, relaxation therapies work better than any dietary change at managing blood pressure similar to the aerobic exercise reduction. Last, what will effect the LARGEST blood pressure reduction in the body is weight loss. If you are overweight, losing weight will have the largest blood pressure reductions.