Replaced jquery events by their equivalent in pure js