How to prevent defaut behaviour of "input submit"?

user6902625

I have an input submit, after attaching an onclick handler on it, what's the standard way to prevent a post request to "form action=xxx" url? Is it "return false", or "e.preventDefault", or "e.stopPropogation"?

Alongkorn Chetasumon

just call preventDefault() like this

$("#myform").submit(function(event){
  event.preventDefault();  

  // DO SOMETHING
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to prevent this "replay caching" behaviour?

From Dev

How to make a input submit button with flat look?

From Dev

how to submit a form without input submit

From Dev

QML: How to reset item property to defaut

From Dev

Prevent QDockWidget autosizing behaviour

From Dev

How to remove the space between Text Input and Submit Button?

From Dev

How to set different background colors for several input submit forms(HTML)?

From Dev

How to resize input/submit box in Bootstrap3

From Dev

Prevent blur behaviour on input element

From Dev

Prevent default behaviour of ringtonepreference in android

From Dev

How to set another value on a boolean with defaut value with Entity Framework Core?

From Dev

How do I differentiate between clicking a submit button and hitting enter in an input to submit a form?

From Dev

How to create an HTML <input> submit button that saves all data to JS variables?

From Dev

Prevent default anchor behaviour if checkbox inside clicked

From Dev

Prevent entity being returned by OData $extend behaviour

From Java

Form not reading input to submit

From Dev

Adding an icon to an input submit

From Dev

input submit on enter hit

From Dev

AngularJs : how to trigger ng-change event for defaut selected value of ng-otons in dropdown

From Dev

argparse: Defaut value for nargs='*'?

From Dev

Spring @Scheduled defaut value

From Dev

Where is the message for the defaut ParticleApplication?

From Dev

Prevent anchor behaviour on click on DOM generated element inside anchor

From Dev

CSS: input['submit'] inconsistent heights

From Dev

Size of input and submit button in percent

From Dev

MaterializeCss Form input (submit) button

From Dev

Form input submit to table with this data

From Dev

change value of input and submit angularjs

From Dev

How to explain this behaviour from DirectoryIterator?

Related Related

  1. 1

    How to prevent this "replay caching" behaviour?

  2. 2

    How to make a input submit button with flat look?

  3. 3

    how to submit a form without input submit

  4. 4

    QML: How to reset item property to defaut

  5. 5

    Prevent QDockWidget autosizing behaviour

  6. 6

    How to remove the space between Text Input and Submit Button?

  7. 7

    How to set different background colors for several input submit forms(HTML)?

  8. 8

    How to resize input/submit box in Bootstrap3

  9. 9

    Prevent blur behaviour on input element

  10. 10

    Prevent default behaviour of ringtonepreference in android

  11. 11

    How to set another value on a boolean with defaut value with Entity Framework Core?

  12. 12

    How do I differentiate between clicking a submit button and hitting enter in an input to submit a form?

  13. 13

    How to create an HTML <input> submit button that saves all data to JS variables?

  14. 14

    Prevent default anchor behaviour if checkbox inside clicked

  15. 15

    Prevent entity being returned by OData $extend behaviour

  16. 16

    Form not reading input to submit

  17. 17

    Adding an icon to an input submit

  18. 18

    input submit on enter hit

  19. 19

    AngularJs : how to trigger ng-change event for defaut selected value of ng-otons in dropdown

  20. 20

    argparse: Defaut value for nargs='*'?

  21. 21

    Spring @Scheduled defaut value

  22. 22

    Where is the message for the defaut ParticleApplication?

  23. 23

    Prevent anchor behaviour on click on DOM generated element inside anchor

  24. 24

    CSS: input['submit'] inconsistent heights

  25. 25

    Size of input and submit button in percent

  26. 26

    MaterializeCss Form input (submit) button

  27. 27

    Form input submit to table with this data

  28. 28

    change value of input and submit angularjs

  29. 29

    How to explain this behaviour from DirectoryIterator?

HotTag

Archive