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

258
Visualizações
How to remove div by a button function with jQuery?

I want to delete a div element that contains 3 input tags. The function named addTextbox adds a div element using 'before'. Now I need to erase this newly created div element. Any solution?

<div id="box" style="margin-bottom: 10px; display: inline-block; width: 100%";>
    <input type="hidden" name="nurse_id[]" value="" />
    <input type="text"  class="form-control"  name="nameAdd[]" placeholder="" style="width:30%;float:left;margin-right:8px";>
    <input type="text"  class="form-control" name="phoneNumberAdd[]" placeholder="" style="width:59%;float:left";>
    <input type="button" class="btn btn-alt-primary" value="+" onclick="addTextbox()" style="width:9%;float:right;font-weight:bold;">
</div>

<script>
let addTextbox = function() {
    let newP = "<div style='margin-bottom: 10px; display: inline-block; width:100%;'><input type='text' class='form-control' name='nameAdd[]' placeholder='' style='width:30%;float:left;margin-right:8px';> " +
        "<input type='text' class='form-control' name='phoneNumberAdd[]' placeholder='' style='width:59%;float:left';> " +
        "<input type='button' class='btn btn-alt-danger' value='-' onclick='removeNewData()' style='width:9%;float:right;font-weight:bold;'></div>";
    $('#box').before(newP);
}
</script>
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