Added the preventDefault to click function