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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:07:50+00:00 2026-06-15T22:07:50+00:00

When using Ajax for form submission, can several forms share the same id? Such

  • 0

When using Ajax for form submission, can several forms share the same id? Such as the following.

HTML:

<form id="myForm" action="/form" method="post"> 
  Phone: <input type="text" name="phone" /> 
  <input type="submit" value="Submit" /> 
</form>
...
<form id="myForm" action="/form" method="post"> 
  Name: <input type="text" name="name" /> 
  Comment: <textarea name="comment"></textarea> 
  <input type="submit" value="Submit Comment" /> 
</form>

Script:

<script> 
    // wait for the DOM to be loaded 
    $(document).ready(function() { 
        // bind 'myForm' and provide a simple callback function 
        $('#myForm').ajaxForm(function() { 
            alert("Thank you for your comment!"); 
        }); 
    }); 
</script> 
  • 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-15T22:07:51+00:00Added an answer on June 15, 2026 at 10:07 pm

    No: as a general principle, whenever you want to use the same term to group a bunch of elements you should use a class name:

    <form class="myForm" action="/form" method="post"> 
      Phone: <input type="text" name="phone" /> 
      <input type="submit" value="Submit" /> 
    </form>
    ...
    <form class="myForm" action="/form" method="post"> 
      Name: <input type="text" name="name" /> 
      Comment: <textarea name="comment"></textarea> 
      <input type="submit" value="Submit Comment" /> 
    </form>
    

    Your JS would then be:

    $(document).ready(function() { 
        // bind 'myForm' and provide a simple callback function 
        $('.myForm').ajaxForm(function() { 
            alert("Thank you for your comment!"); 
        }); 
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting Error in submitting the form using AJAX and Jquery, following is
I have made a form validation using ajax post method. But i got the
I'm working on a form validation and submission using jQuery and AJAX. Now, most
Can anyone please help me in finding good tutorials for php/jquery/ajax form submission validating
I am using an MVC 3 Ajax.BeginForm call for form submission with client side
I have the following form in a website of mine. <form action= method=GET> <input
I am using jQuery and MVC to do form submission like this @using (Ajax.BeginForm(Orders,
I'm having trouble to display data after form submition using JS and AJAX here
I'm using Jquery Ajax Form to upload files, which works well in Chrome and
I am using Ajax.Begin Form in my MVC 3 + Razor application using (Ajax.BeginForm(ActionName,

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.