electromagnet

A current-carrying coil with a soft iron core, which has appreciable magnetic effect only when there is a flow of current.