electromagnet

A magnet that works only when electricity flows through it.