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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:44:53+00:00 2026-06-16T23:44:53+00:00

I have the following markup <span id=add> <li style=float: left;margin-right: 10px;> <b class=bg>Nom</b><br />

  • 0

I have the following markup

<span id="add">

  <li style="float: left;margin-right: 10px;">
     <b class="bg">Nom</b><br />
     <input type="text" class="_input _input_text nom"/>
  </li>

  <li>
    <b class="bg">montant investi</b><br />
    <input type="text" class="_input _input_text montant"/>
    <a class="_button"
       onclick="$('#add').append(
          '<span>\
            <li style=\'float: left;margin-right: 10px;\'>\
              <b class=\'bg\'>Nom</b><br />\
              <input type=\'text\' class=\'_input _input_text nom\'/>\
            </li>\
            <li>\
              <b class=\'bg\'>montant investi</b><br />\
              <input type=\'text\' class=\'_input _input_text montant\'/>\
              <a class=\'_button\' style=\'float:right;margin-top:0;margin-left:5px\' \
                onclick=\'$(this).parent().parent().remove();\'>\
                <b>X</b>\
              </a>\
            </li>\
          </span>');"
       style="float: right;margin-top: 0px;margin-left: 5px;">
        Ajouter un associé
    </a>
  </li>

</span>

The onclick function creates a markup with two <li> with input text inside. There are two class of inputs: .nom, .montant.

When I try to collect them using this function:

var _nom=[];

_nom.push($("#add input.nom[type=text]").val());

$.each(_nom, function(key, value) {
  alert(key + ': ' + value);
});

I only get the values of the two inputs that are not created dynamically.

  • 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-16T23:44:54+00:00Added an answer on June 16, 2026 at 11:44 pm

    You need to use this instead:

    $("#add input.nom[type=text]")
    .each(function(key, value) {
      alert(key + ': ' + $(value).val());
    });
    

    http://jsfiddle.net/4UhqL/

    It gives you wrong result, because $("#add input.nom[type=text]") returns you array of elements, not the one element.

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

Sidebar

Related Questions

I have the following markup <ol> <li class=ListItem> <span class=sub>@qItem.CategoryText</span> <input type=image src=http://icons.iconarchive.com/icons/tatice/just-bins/256/bin-red-full-icon.png width=30
If I have the following markup <div id=previewNote class=note yellow style=left:25;top:25px;z-index:1;> <div class=body></div> <div
I have the following markup: <button class=button type=button><span>Edit</span></button> I want to have a click
I have the following markup as a base: <div> <span>some dynamic text</span> <input type=text
I have following markup: <div class=twocol float-left> <h4>left</h4> <p>first</p> <p>second</p> <p>third</p> </div> <div class=twocol>
I have the following markup: <div style=height:100px; width:280px; float:left > <p style=float:left; padding:5px; id=optionOne>
We have following markup <input type=checkbox class=foo /> <input type=checkbox class=foo /> <input type=checkbox
I have the following html markup: <div class=wrap_select> <span class=select id=selectdateRange>Today, 25 March, Sun</span>
I have the following markup: <input id=displayBuffer type=hidden> <textarea id=about rows=2 name=about cols=20 aria-hidden=true><p>test</p></textarea>
I have the following markup: <p class=managebox> <button value=Add page> <img src=page_add.png alt=Add more

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.