Ionic bonding is the transfer of electrons.
In ionic bonding, atoms lose or gain electrons to form positively or negatively charged atoms (or groups of atoms) called ions. Because of the attraction of opposite charges, + and -, the ions are then strongly attracted to one another.
All the atoms over at the left-hand side of the periodic table, e.g. sodium, potassium, calcium, etc.., have just one or two electrons in their outer shell - which means they're keen to get rid of them because then they'll have full shells left (how they like it).
So when they get rid of electrons, it leaves the atom as an ion. They then tend to leap at the first passing ion with an opposite charge and stick to it like glue.
A nearly full shell is keen to get that…