The donkey was used by the Andrew Jackson campaign as far back as 1828; it became popularized through an 1837 political cartoon by Henry R. Robinson, depicting Jackson leaving office, riding a donkey and beating it to drive it faster; waiting for it is a gaunt woman with a sword who represents bankruptcy; the caption reads, "The Modern Balaam and His A*s".
The elephant was the creation of political cartoonist Thomas Nast (1840-1902), who used it in 1874 to depict the Democratic takeover of the House of Representatives for the first time since the end of the Civil War; the cartoon showed the Republican Party as a panicked elephant running away from a donkey dressed in a mangy lionskin. Nast used both the donkey and the elephant as symbols for the Democrat and Republican parties over and over again until they became ingrained in the American political mélange.