got js to handle states of buttons