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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:37:03+00:00 2026-06-12T17:37:03+00:00

I have multiple forms on a page. I have created a button to hide

  • 0

I have multiple forms on a page.
I have created a button to hide and dislpay each form (which works).
I am trying to add the value from #family_name after the button to identify what the button is for.
However the value for the first #family name appears after each button on each form. I want the value associated with that particular form to appear.

(i know the button is getting put in a silly place…not a problem at this stage)

var family = $("input#family_name").val();
$("input#salutation").after("<button title=\"View, Amend or Add\" id=\"chnx\">+</button><span>" + family + "</span>");

<div id="1">
<form id="1">
<fieldset>
<p>
<label for="salutation">Salutation</label>
<input name="salutation" id="salutation" class="required" value="Mr" type="text">
</p>
<p>
<label for="family_name">Family Name</label>
<input name="family_name" id="family_name" class="required" value="Parker" type="text">
</p>
<p>
<label for="first_name">First Name</label>
<input name="first_name" id="first_name" class="required" value="" type="text">
</p>
<p>
<label for="middle_name">Middle Name</label>
<input name="middle_name" id="middle_name" class="required" value="" type="text">
</p>
<p>
<label for="DOB">Date of Birth</label>
<input name="DOB" id="DOB" class="required" value="" type="text">
</p>
<input value="Add" id="add" type="submit">
<input value="Amend" id="amend" type="submit">
</fieldset>
</form>
.......
<form id="2">
.......
.....mutliple forms......
.......
</div>
  • 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-12T17:37:04+00:00Added an answer on June 12, 2026 at 5:37 pm

    ID’s must be unique in a page so you can’t look for the first element with an ID.

    WHat you ill need to do is change them to a class name ( as well as all other elements in each form that duplicate) and loop over each form to look only within that form for the data and to make the append.

    Something like the following

    $('form').each(function(){
        var family = $(this).find("input.family_name").val();
         $(this).find("input.salutation").after("<button title=\"View, Amend or Add\" id=\"chnx\">+</button><span>" + family + "</span>");
    
    });
    

    It would likely be best to also add a common class name to the forms in case you have any other type of form like a login that is not related to this manipulation

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

Sidebar

Related Questions

I have a page which dynamically creates multiple forms, each form had a unique
I have multiple forms on a page, for each of them I want the
I have an application with multiple forms, each form has the same icon, so
I have a page that displays multiple Formsets, each of which has a prefix.
I have a page that creates multiple forms for each object that I had
I have multiple ajax forms on page that cointain same elemets, I have jquery
I have multiple forms for lots of products on my page and want to
I have a page with multiple forms that I submit via Ajax POSTs serially.
I have several dynamically created links and forms on one page named with IDs
I have a form (a dynamically created questionnaire) with multiple questions. I have used

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.