Moving electrons are always surrounded by closed magnetic lines of force lying in a plane perpendicular to their motion. That is, an electric current generates a magnetic field which surrounds the conductor carrying the current and is at right angles to the direction of current flow. The field disappears when the current is shut off, because air has no magnetic retentivity.
The strength of the magnetic field set up by an electromagnet depends on the amplitude of the current, the number of turns in the coil, the shape of the coil, the magnetic properties of the material surrounding the coil, and the lenght of the magnetic path. Nonferrous materials are in general the same air in their magnetic properties.