There were 7 buttons on each card from Elaine's grandmother
In total, there were 40 buttons since there were 5 piles of 8 buttons. Because Elaine had 5 buttons in the pile the other 35 were her grandmother's buttons. If each of the 5 cards had the same number of buttons on them then there would be 7 buttons on each card.