I think there are some confusing statements in the postings above. Note that when we are talking about waves, we can classify waves as mechanical waves or electromagnetic waves.
1. A mechanical wave is a disturbance that travels through some material or substance called the medium for the wave. As the wave travels through the medium, the particles that make up the medium undergo displacements of various kinds, depending on the nature of the wave.
Mechanical waves travel only within a material medium, such as air or water. Two familiar mechanical waves are sound waves and water waves.
Mechanical waves may be divided into two types, based on the direction of the particles' oscillations relative to that of the wave velocity.
In a transverse wave, the oscillation of particle in the medium is perpendicular to the direction of the wave velocity or direction of travel of the energy.
In a longitudinal wave, the oscillation of particle in the medium is parallel to the direction of the wave velocity or direction of travel of the energy.
Mechanical transverse waves can occur only in solids, whereas mechanical longitudinal waves can travel in solids, fluids, and gases.
2. Electromagnetic waves, from radio waves to visible light to gamma rays, are a self-sustaining oscillation of the electromagnetic field, that are generated by oscillating electric charges. Electromagnetic waves are transverse waves because the electric field and magnetic field are oscillating in a direction that is perpendicular to the direction of travel of the wave. See below.
Electromagnetic waves require no material medium and can travel through a vacuum.
Hope it helps.