Yes, that's where the origin of the icon came from, it was done and popularized by political cartoon satirists. The same for the elephant. However, their usage came with actual meanings and explanations.
The donkey has long been symbolized as a livestock that works for man. It represents the motto of the early DNC, "We work for the common man" like a donkey does.
The elephant is easier to identify, it symbolizes strength, stability, and nobility.