add js to control buttons