Source: history channel
Open the following link and hit the green "Run Now!" button.
Open the program and Play with the simulation
https://phet.colorado.edu/en/simulation/magnets-and-electromagnets