Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8201159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:42:50+00:00 2026-06-07T06:42:50+00:00

All, I have the following jQuery code: jQuery(#data_form).submit(function() { event.preventDefault(); alert(it submits); }); When

  • 0

All,
I have the following jQuery code:

jQuery("#data_form").submit(function() {
    event.preventDefault();
    alert("it submits");
});

When I submit the form in Chrome it works fine but not in IE8. I tried to change the code to something like this:

jQuery("#data_form").submit(function(e) {
    e.preventDefault();
    alert("it submits");
});

This however still posts the page. Any idea on how to make this code work in IE8?

***EDIT: I tried to simplify the code for readability on here. However I tried the answer below and it didn’t work yet. Here is the complete code:

jQuery("#event_form").submit(function(e) {
    e.preventDefault();
    jQuery("#results").html('');
    already_submitted = jQuery("#check_submission").val();
    create_yes_no = jQuery("#create_yes_no").val();
    if(already_submitted!="yes" && create_yes_no=="yes" ){
    jQuery.post(site_url + "save_event_form.php", jQuery(this).serialize(),
        function(data) {
            //alert("Data Loaded: " + data);
            var results = jQuery("#results");
            results.html(data+"<br><br>");

            results.show(); // re-display the div
            setTimeout(function(){ // then fade it out....
              results.fadeOut();
            }, 5000); // ...after 5 seconds
            jQuery("#check_submission").val("yes");
        });
    }else if(create_yes_no!="yes"){
    jQuery.post(site_url + "save_event_form.php", jQuery(this).serialize(),
        function(data) {
            //alert("Data Loaded in the create yes or no yes: " + data);
            var results = jQuery("#results");
            results.html(data+"<br><br>");

            results.show(); // re-display the div
            setTimeout(function(){ // then fade it out....
              results.fadeOut();
            }, 5000); // ...after 5 seconds
        });
    }else{
        alert("You already submitted this user once. Refresh the page to add another one.");
    }
    return false;
});

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:42:52+00:00Added an answer on June 7, 2026 at 6:42 am

    event.preventDefault doesn’t work in IE8. I changed it to be this code and it works good now:

    if(event.preventDefault){
        event.preventDefault();
    }else{
        event.returnValue = false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: var formSubmitHandler = function (link, form) { //e.preventDefault(); var
I have the following jQuery code: $('.save').submit(function(e){ var formElement = $(this); var data =
I have the following jQuery code: $('.button').click(function(e) { e.preventDefault(); var id = $(this).attr('id'); var
All, Say I have the following bit of code: select: function(start, end, allDay) {
I am implementing the Jquery UI autocomplete. I have the following code. Application.js $(function()
I have the following jQuery Code: $(#menu span).click(function() { var url = this.getAttribute(data-url); var
I have the following code: function build_all_combinations(input_array){ array = [1,2,3] limit = array.length -
I have a form I'd like to submit as JSON via jQuery AJAX, so
I have the following jQuery ajax call setup: function Testing() { var result =
I have a login page using jQuery Mobile which contains the following code: <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.