A covalent bond is formed when an element shares its valence electron with another element. This bond is formed between two non metals.
For example:
An ionic bond is formed when an element completely transfers its valence electron to another element. The element which donates the electron is known as electropositive element and the element which accepts the electrons is known as electronegative element. This bond is formed between a metal and an non-metal.