Event.preventDefault(); Not Working When Submitting Form
I am trying to put the result from a submitted form in to a div instead of opening it inside a new window. The problem is that my event.preventDefault(); doesn't seem to be working
Solution 1:
My best guess is that you are adding your #contactForm
submit listener before the form is actually rendered. Try wrapping your jQuery in $(document).ready(function () {});
I don't see any other issues.
Solution 2:
Using <script type="text/javascript">
, your script will not work, replace <script type="text/javascript">
with <script language="javascript">
, It will work correctly. But language="javascript" is deprecated in favor of type="text/javascript". keep in mind you put the code $(document).ready(function(){ //code to be implemented// });
Anyhow your script will work by replacing type="text/javascript" with language="javascript"
Post a Comment for "Event.preventDefault(); Not Working When Submitting Form"