As an aside, we might consider just what is electromagnetic radiation? There is a magnetic field associated with moving charged particles. If the charged particles accelerate, the associated magnetic field changes, and, while it is changing, it induces an electric field. The magnetic and electric fields are mutually perpendicular.
Now begin by reading a summary of the story outlined below.
1700(approx) Newton used a prism to disperse white light into a spectrum of colours.
1850(approx) Fraunhofer designed a spectrometer and systematically studied the spectrum of sunlight. He found absorption lines in the solar spectrum. He also made diffraction gratings which enabled him to measure wavelengths of yellow sodium light and of the Fraunhofer lines.
1860 Kirchhoff and Bunsen showed that each element emitted a unique line spectrum. This was a powerful analytical tool, and enabled them to discover elements rubidium and caesium.
1883 Liveing and Dewar published extensive tables of spectra of alkali metals, and studied the spectrum of the corona around the sun during solar eclipse..
1885 Balmer developed mathematical formulae for some lines in the hydrogen spectrum. The visible lines in the hydrogen spectrum are named after him. (Look at some of the other slides in the series shown in this linked site.)
1890 Rydberg found formulae for some spectral lines in other elements.
1908 Ritz was able to extend the work of Rydberg. Paschen, Brackett and Pfund found further lines.
The analysis of lines in emission and/or absorption spectra fitted well with predictions made by the Bohr theory of the atom.