Donkey
Andrew Jackness stood for the presidential seat in 1828; he was the first democrat too. His opponent tried to call him a 'jackass' because of his slogan which got huge popularity 'let the people rule'. He got amuse by this sign and it worked positively for him in his campaigning.
Elephant
In 1874 a cartoon appeared in the Harper's magazine, showing that donkey is wearing a lion's costume and he is scaring away the animals; but elephant didn't. That's why it became the republican sign.