help with a clone element of jquery

0

I have a problem with a jquery clone element: I clone the next element.

$(document).ready(function(){

  $(".alergia-boton").click(function(){
    if ($("#id_alergia_paciente").val().length <= 1) {
        return false
    } else {
      $( "#id_alergia_paciente").clone().appendTo( "#contenedor_alergia");
      $('#id_alergia_paciente').val("");
    }
  });

});

So all right because clono and pass the value of the input that clono my question is: how do I collect the data every input cloned and enter them in the database table is allergies and only has id field, patient id and field allergies that is where you would save each clone. They like it very much if they help me with this since I've been here for days and I do not know how to do it

HTML CODE this is the cloned input:

 <input 
   name="alergia"
   id="id_alergia_paciente"
   placeholder="Ingrese una alergia"
   type="text"
   class="validate alergia">

this would be the container where it is cloned:

    
asked by solis j 19.12.2018 в 21:36
source

0 answers