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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:00:51+00:00 2026-06-03T06:00:51+00:00

One of my form allows to add multiple elements using Jquery. Following HTML shows

  • 0

One of my form allows to add multiple elements using Jquery. Following HTML shows the demo content,

<form name="my-location-frm">
    <div class="address">
        <input type="text" name="house-name" value='house1'>
        <input type="text" name="street-no" value='street1'>
    </div>

    <div class="address">
        <input type="text" name="house-name" value='house2'>
        <input type="text" name="street-no" value='street2'>
    </div>

    <div class="address">
        <input type="text" name="house-name" value='house3'>
        <input type="text" name="street-no" value='street3'>
    </div>

    <input type="submit">
</form>

Here class="address" wrapper will repeats many times. How can retrieve each element (house-name,street-no) values using Jquery

Tried as follows,

$.each($(".address"), function(key,value) { 

     hn = $(value).children("input[name=house-name]").val();
     console.log(n);
}

But fails 🙁

Expected Javascript output,

house1,street1
house2,street2
house3,street3
  • 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-03T06:00:53+00:00Added an answer on June 3, 2026 at 6:00 am

    Use this variant instead:

    $(".address").each(function() {
        var house = $(this).children("input[name='house-name']").val();
        var street = $(this).children("input[name='street-no']").val();
        console.log(house + "," + street);
    });
    

    Or (if you need) you can gather all the input values in the array:

    $(".address").each(function() {
        var values = [];
        $(this).children("input").each(function() {
            values.push(this.value);
        });
        console.log(values.join(","));
    });
    

    DEMO: http://jsfiddle.net/PtNm5/

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

Sidebar

Related Questions

I am using jquery to add mulitple new addTask form elements to a ul
In one form I am creating a territory and editing multiple users. The "user_attributes"
I have multiple images inside one form. Depending on the image clicked a specific
I've got a form that allows the user to edit an employees information: name,
I have a form that allows a user to add an unlimited number of
I have a form that allows the user to add as many upload forms
I have a form that allows users to refer friends. I want to add
I have a form that allows users to refer friends. I want to add
Is there a JQuery plugin that allows me to 'unhide' a form by after
I have a product registration form that allows the user to add additional product

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.