If there is blood or mucus or if it has lasted more than a few days, go to your vet! Do not wait too long to address this problem as your dog may have fluid and nutrient loss that may result in death if you don’t receive treatment. A sample of your pets stool could help your vet. In small, old, or young dogs, the situation can get serious very quickly.
There are many things that can cause diarrhea from eating something disagreeable, eg. fatty foods, overeating, stress, antibiotics/drugs, parasites, various types of infections, pancreatitis, intestinal obstruction, worms, contagious or infectious viruses, liver or kidney disease, cancer or diabetes. Call and go to your vet….self-diagnosis will be a guess at best.
The main cause of short term diarrhea in dogs (very similar to people) is diet--they ate something (maybe food you gave them or they came upon) or drank something. In the winter, be careful of antifreeze which is toxic to pets. If you have recently changed foods, this might be the issue. If they got into your trash, they might have gotten some bacteria, fungus, or parasite lurking around. So, try and do your best to keep them out of the trash.
Again, if there is blood or mucus, continuous, or violent diarrhea, or if your dog is vomiting and having diarrhea, make sure you keep your pet hydrated (water), and get to the vet.
If you think your dog has a mild case of diarrhea, call your vet and you can probably provide a bland diet of rice, small pieces of chicken (no bones, skin or breading), fresh water (make sure they are drinking it--if they don't, call your vet--dehydration is very serious) and possibly small amounts of non-spiced/no sugar pumpkin--not pie filling but pure canned pumpkin. Avoid high fat/oily foods.
There are also probiotics, OTC products and various prescriptions--call your vet.