That's because all the electrons on you went into the doorknob all at once in a static shock
Ah! This doorknob just shocked me
What is an electron?
An electron is a part of an atom. There are three parts of an atom, electrons, protons, and neutrons. When you rubbed your feet on the carpet, the electrons from the carpet go onto you, giving you a negative charge. When you touched the doorknob, the electrons flow into it as static electricity.
Cool, so does that mean it's like the electricity in lightning?
Yes, the electrons in the sky are attracted to the protons in the ground, releasing energy in a bolt of lightning
Wait, the electrons are attracted to a positive charge?
Yes, things with positive charges are attracted to things with negative charges, but things with both positive charges or both negative charges repel each other.
But, when I touch the door, there is no electric shock
That's because the door is an insulator. In an insulator electric currents can't flow freely, whereas in a conductor it can. Conductors are usually metallic, while insulators are usually non-metallic.