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 8080511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:26:09+00:00 2026-06-05T16:26:09+00:00

It is has been suggested that it is best to initialize a $(‘#form’).validate({}) function

  • 0

It is has been suggested that it is best to initialize a $('#form').validate({}) function on page load rather than on a click event: jquery.form/validate plugin only allow submit if input is changed

I’m wondering how to do this for multiple dynamically added forms without wrapping the $('#form').validate({}) function inside of a on('click', 'input[type="submit"]', function.

Take this code for example:

var id="some identifier for the specific form that is submitted";
`$('#form'+id).validate({})`
  1. How does this unique identifier, id, which is required to distinguish each form get created in the first place?
  2. And what if you don’t know the id after the page is loaded because it has been created dynamically, e.g., by AJAX.

I have been doing this but this is is what’s not recommended:

$(document.body).on('click', 'input[type="submit"]', function(){
  var id=this.id;
  $('#form'+id).validate({});
});

thoughts?

thanks,
tim

  • 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-05T16:26:11+00:00Added an answer on June 5, 2026 at 4:26 pm

    If the form does not exist at all when the page loads, then instead of initializing the .validate() on submit, I’d initialize it immediately after the form is created…

    // code that dynamically creates #myNewform, then initialize validate()
    
    $('#myNewform').validate();
    

    (validate() should not be inside a submit handler because the validation is not initialized until after the submit button is clicked. This leads to issues when the form fails validation and must be submitted a second time. The second submit then re-initializes the plugin on the form a second time. See here, here, and here for similar issues.)

    For existing form on page…

    $(document).ready(function(){
        $('#myform').validate();
    });
    

    or for multiple form‘s sharing same validation options…

    $(document).ready(function(){
        ('.myform').each(function(){
            $(this).validate();
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It has been suggested that I use CSS for displaying XML. I know in
In other cases it has been suggested that you simply add a SerializationBinder which
It has been suggested to me that I rearrange my code to pool my
This has been a rather problematic issue on numerous occasions. We have alot of
When working with a console application, a history of everything that has been entered
I am aware that this topic has been covered already in many places, but
It has been asked when MeteorJS will have auth in place... I think everyone
this has been an ongoing problem with me, ive been trying to make a
This has been a massive headache. We use Ning as a our platform for
This has been frustrating me for a while now. I started developing a site

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.