Takes a function and returns a function that calls preventDefault on the last argument of the function