I have the following structure.
function agregarDetalle(idarticulo,nombre)
{
var cantidad=1;
var precio_compra=1;
var precio_venta=1;
if (idarticulo!="")
{
var subtotal=cantidad*precio_compra;
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="hidden" name="idarticulo[]" value="'+idarticulo+'">'+nombre+'</td>'+
'<td><input type="number" name="cantidad[]" id="cantidad[]" value="'+cantidad+'"></td>'+
'<td><input type="number" name="precio_compra[]" id="precio_compra[]" value="'+precio_compra+'"></td>'+
'<td><input type="number" name="precio_venta[]" value="'+precio_venta+'"></td>'+
'<td><span name="subtotal" id="subtotal'+cont+'">'+subtotal+'</span></td>'+
'<td><button type="button" onclick="modificarSubototales()" class="btn btn-info"><i class="fa fa-refresh"></i></button></td>'+
'</tr>';
cont++;
detalles=detalles+1;
$('#detalles').append(fila);
modificarSubototales();
}
else
{
alert("Error al ingresar el detalle, revisar los datos del artículo");
}
}
to which I need to add separators of thousands to the input with id #precio_buy and #precio_venta
probe with the examples: Thousands separator with javascript php or Jquery and < a href="https://es.stackoverflow.com/questions/128303/como-dar-formato-de-n%C3%BAmero-a-todos -los-elementos"> How to give a number format to all the elements?
but none of them works for me.