Electromagnets work on the principle of
Magnetic effect of electric current
Electromagnet is a soft metal core made into a magnet by the passage of electric current through a coil surrounding it. It is based on the magnetic effect of electric current.