toggle switch

groundFungus:
Please show how the switch (button) is wired.

To test my theory, insert a delay(1000) below the preButtonState = buttonState; line and see what happens.

Take a closer look at the state change detection example to see how to fix your sketch.

I've attached my wiring in my first post.
I've also tried to add a delay as you mention, now the led can light up when the button is press once.
However, the led will not turn off if I press the switch another time.