:::: MENU ::::

Form auto-submission tips for jQuery

jQuery form auto submission with submit() method.

jQuery provides method called submit() available to <form> Object.

It also passes callback function that executes before form submit event fires.

You could use callback within above function to validate form.

Now whenever you call this function from element’s onclick event it form will be submitted.

Other way to get this done is jQuery on() method.

  Things to keep in mind.

  • Don’t use “submit” attribute as name or id of any elements. (i.e <input type=”submit” name=”submit”> it may create issue firing auto-submit event as well as form validation.
  • Don’t break <form> tags or create child <form> tags within <form>

jQuery trigger method to make form autosubmit

jQuery provides trigger(‘EVENT_NAME’) method provide to auto fire elements programmatically. All you need to do it. just call it by supplying ‘submit’ as argument.

or more way is you simulate submit button’s click event, so whatever events are attached with click event (i.e. validation and other stuffs will be called)


So, what do you think ?