Corrected code for non-existent "problem" of preventDefault() not working