* Sodium (Na) has one valence electron, which it readily loses to become a positively charged ion (Na+). This makes sodium a cation.
* Chlorine (Cl) has seven valence electrons and readily gains one electron to become a negatively charged ion (Cl-). This makes chlorine an anion.
Opposite charges attract! The positively charged sodium ion (Na+) is attracted to the negatively charged chloride ion (Cl-). This attraction is a strong electrostatic force that holds them together to form an ionic bond.
Think of it like magnets: the north pole (positive) is attracted to the south pole (negative). In the case of sodium and chlorine, the opposite charges are what cause them to "stick" together.