Shouldn't trigger() be defined before the addEventListener() call?