Good day, I'm trying to put a value in a normal amount input, click on a button and I get the number of fields that says in quantity.
I'm doing it this way but I only get 2 fields so I put 4.
var cantidad = document.getElementsByName("cant");
function agregarDetalle(idseriales,serial){
for (var i = 0; i <=cantidad.length; i++) {
var fila='<tr class="filas" id="fila'+cont+'">'+
'<td><button type="button" class="btn btn-danger" onclick="eliminarDetalle('+cont+')">X</button></td>'+
'<td><input type="text" name="serial[]" value="" id="serial[]"></input></td>'+
'<td><button type="button" id="agregarArt" class="btn btn-primary" onclick="agregarDetalle()"><span class="fa fa-plus"></span></button><td>'+
'<td><input type="hidden" name="idseriales[]" id="idseriales[]" value="'+idseriales+'"></input></td>'+
'</tr>';
cont++;
detalles=detalles+1;
$('#detalles').append(fila);
}
}
I would appreciate your comments since I do not know how to do so that I take the value that I put in the input