Quiero eliminar un elemento div que contiene 3 etiquetas de entrada. La función llamada addTextbox
agrega un elemento div usando 'before'. Ahora necesito borrar este elemento div recién creado. ¿Alguna solución?
<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>