added the js code to events.js