Capacitor works only on ac. It blocks dc source given to it.
Now let us see what actually happens
When an ac supply is given to the capacitor it gets charged(after all it is a charge storage device).This stored charge gets discharged when the supply is removed.
How does it actually store charges ??
The parallel plate in a capacitor are the ones which help in charge storage. They cause the potential difference resulting in charge storage.
So when a capacitor is given ac, it charges and “discharges” when removed.
So this what happens when ac is given to a capacitor…..
Think simply capacitive reactance =1/WC where W =angular frequency since W for DC =0
Capacitor offers infinite resistance to flow of DC and allows AC to flow