Atoms with high electronegativity, such as fluorine and oxygen, have a strong pull on electrons. When these atoms bond with less electronegative atoms, such as sodium and potassium, the electronegative atoms attract the shared electrons more strongly, pulling them closer to their own nucleus. This unequal sharing of electrons leads to the formation of ions.
In an ionic bond, the more electronegative atom gains electrons from the less electronegative atom, resulting in the formation of negatively charged ions (anions) and positively charged ions (cations), respectively.
For example, when sodium (Na) and chlorine (Cl) atoms form an ionic bond, the highly electronegative chlorine atom attracts the electron from the sodium atom, resulting in the formation of a sodium cation (Na+) and a chloride anion (Cl-).
The electron transfer in ionic bonding occurs to achieve a more stable electron configuration for both atoms involved. By gaining or losing electrons, atoms can complete their outermost electron shells, which allows them to attain a lower energy state and increased stability.