JS: Adding event on the control panel