Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

193
Visualizações
Dynamic text boxes to textbox

I am attempting to create dynamic text boxes then pull that info into a text box so i can copy it. I got the code to add the boxes but i dont know how to get the information from the boxes to compile and go into my AddRESS text box.

HTML

<div class="row">
<div class="cell">
<button class="cell add_form_field" style="color: black;">Add New Field &nbsp; 
<span style="font-size:16px; font-weight:bold; color: black;">+ </span>
</button>
</div>
<div class="cell container1">
<div><input type="text" name="myAdd[]"></div>
<div class="container2">
<div><input type="text" name="myMAC[]"></div>
</div>
</div>
<textarea id="AddRESS" rows="10" cols="49" style="overflow: auto; width: 500px;font-size: 10px;"></textarea></div>
</div>
</div>

JavaScript

$(document).ready(function() {var max_fields = 20;var wrapper = $(".container1");var add_button = $(".add_form_field");var x = 1;
$(add_button).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
        x++;
        $(wrapper).append('<div><input type="text" name="myAdd[]"/><a href="#" class="delete">Delete</a></div>'); //add input box
    } else {
        alert('You Reached the limits')
    }
});

$(wrapper).on("click", ".delete", function(e) {
    e.preventDefault();
    $(this).parent('div').remove();
    x--;
})});$(document).ready(function() {var max_fields = 20;var wrapper = $(".container2");var add_button = $(".add_form_field");var x = 1;
$(add_button).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
        x++;
        $(wrapper).append('<div><input type="text" name="myMAC[]"/><a href="#" class="delete">Delete</a></div>'); //add input box
    } else {
        alert('You Reached the limits')
    }
});

$(wrapper).on("click", ".delete", function(e) {
    e.preventDefault();
    $(this).parent('div').remove();
    x--;
})});

I have tried this

var values = $("form [name='myAdd[]']").map(function(){return $(this).val();}).get()document.getElementById("AddRESS").innerHTML = values;

and several other things but I only get undefined errors in my AddRESS box.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda