Create a function to change the state of the button.