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