Moved e.prevent to the beginning