The alkaline batteries commonly used in toys, flashlights, and other everyday gadgets contain a liquid electrolyte, potassium hydroxide. Potassium hydroxide is a powerful alkaline chemical and leaks can damage the electronic device the battery is installed in. If the battery is leaking from the terminals it's probably shot and should be discarded. More important, you need to clean alkaline battery leakage from terminals before the corrosive effects of the alkaline ruins the device it was installed in.
Verify that the battery is an alkaline-type battery. Acid-type batteries also contain electrolyte fluids, but they are acid. You should use an acid to clean leakage from alkaline battery terminals, but acid batteries require an alkaline cleaner. Reversing the two may make a worse mess and can be hazardous (for acid-type batteries, you can follow this same procedure except use baking soda, which is alkaline).
Follow safety rules. Potassium hydroxide can cause respiratory damage, skin irritation and eye injuries. Work in a properly ventilated space. Always wear gloves and eye protection when cleaning leakage from alkaline battery terminals.
Remove the leakage from electrical contacts and other surfaces using vinegar or lemon juice applied with a small brush, such as an old toothbrush. Do not use water. Water will not neutralise the alkaline and may damage electronic circuitry.
Allow the cleaned area to dry, and then wipe the surfaces and contacts with a barely damp cloth. Set the device in a dry place for several hours so it will dry completely before installing new batteries.
Remove alkaline batteries from electronics when storing for long periods. This reduces the chance the batteries will start leaking (and keep them from damaging anything if they do). Always store the batteries in a dry place. Avoid mixing brands of alkaline batteries in the same device. This can increase the chances of a leak developing.