move inline alert to addEventListener