Fleas eat food, but it might not be what you consider food. Fleas are parasites, and eat the blood of a host as their preferred source of food, but they will also eat almost any organic substance if they cannot obtain blood.
Flea larva, after emerging from the egg, will eat anything within reach, including the feces of adult fleas. They have up to two weeks to obtain blood from a suitable host in order to become adult fleas, otherwise they will die. An adult female flea must eat a blood meal in order to successfully reproduce.
Most current topical flea medications for dogs and cats introduce a chemical into their blood which is toxic to the adult flea and kills it before it is able to reproduce, thus breaking the life cycle of the fleas.