Understanding how a button works