Use on function instead of addEventListener