We can make a simple touch switch using only two inverter gates, two resistors, and two capacitors. The schematic diagram of the circuit is shown in the figure below. At power up, the output (of U1A) will be high, and the inverting output will be low because U1A gate will be triggered to ground level by C2. After triggered, the low level of U1A input is maintained by U1B output via R2.
If we touch the pad at this condition, where the output is high, then the U1A input will go high because we “short” the voltage of C1 to the input pin, and the low level previously caused by low level of U1B output voltage connected via R2 can’t be maintained because our skin resistance is much lower than 10M. After U1A input goes high then U1A output will go low, and now U1B will go high to maintain high voltage level of U1A via R2, so we can release our finger without loosing the last state. Touching the pad again after we release our previous touching will toggle the output as the condition is reversed.
After we touch the pad, we have to release before 1 second (R2C2 time constant) elapsed. If we touch the pad longer than R2C2 time constant then the output will oscillate (about 1 Hz).