using on instead of the events
Upgraded jquery version