Add sub function for click events.