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

  • Home
  • SEARCH
  • 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 8995765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:39:47+00:00 2026-06-15T23:39:47+00:00

I can’t get my on(‘submit’) event handler to prevent submitting the form using event.preventDefault();

  • 0

I can’t get my on(‘submit’) event handler to prevent submitting the form using event.preventDefault();

 $("section.shopping-cart").on('submit','form.adjustform input[type="submit"]', function(event)     {   

      // code

      event.preventDefault();
 }) 

i had had it working using on(‘click’) and using return false. Altho i’ve read that the above method is the correct way of doing it..

Thanks,
Cam

  • 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-15T23:39:48+00:00Added an answer on June 15, 2026 at 11:39 pm

    You’re using the delegating form of on, with the selector selecting something other than a form element:

    // Here ------------------------------------------------v
    $("section.shopping-cart").on('submit','form.adjustform input[type="submit"]', ...
    

    The submit event occurs on form elements (at least, the one you can usefully cancel does). Specify a form element:

    $("section.shopping-cart").on('submit','form.adjustform', ...
    

    Here’s an example of it not working because the selector selects non-form elements:

    Example | Source

    And here’s the corrected example working correctly:

    Example | Source

    (Note: The forms open in new windows, just to avoid taking you away from the code.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can I authenticate with just Google account username and password instead of using OAuth?
Can any one tell, how to get the result of LINQ query contains group
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can MOSS integrate and get user profiles from multiple Active Directory and/or LDAP stores?
Can anyone tell me what i am doing wrong? I am trying to get
Can I prevent an .apk from being installed if unknown sources is checked?
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Can find why i get this error can someone help? package Android.data; public class
Can't get over it, no matter how much I search. I have AlarmManager, where

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.