add an event listener for checkbox