Step-by-step explanation:
An ionic bond is defined as the bond formed due to transfer of electron(s) from one atom to another.
For example, potassium is a metal with atomic number 19 and electronic configuration 2, 8, 8, 1.
And, chlorine is a non-metal with electronic distribution 2, 8, 7. Hence, to attain stability potassium needs to lose one electron whereas chlorine needs to gain an electron.
So, when an electron is being transferred from potassium to chlorine then
and
ions will form and result into an ionic compound KCl.
Thus, we can conclude that ionic bond occurs when atoms transfer electrons and as a result are oppositely charged and bond together.