Good evening, I have this view (the image) which is part of an invoice, precisely this is the detail of the invoice, and I have in this detail a javascript function so that while I write the name of the product I search the product in the database and when I select it I fill the input of the unit price corresponding to that product, until there all wonders, but the problem is that by pressing the + button to enter a new line and load a new product javascript function no longer works, it occurred to me that I can use a foreach or something similar to make that function work every time a new line is inserted but I can not make it work, I leave the code:
//metodo para buscar en la base de datos
$("#inputPrecioProducto").devbridgeAutocomplete({
showNoSuggestionNotice: true,
serviceUrl: '/maderas/facturar/leer_productos',
noSuggestionNotice: 'No se encontraron datos',
onSelect: function (suggestion) {
$('#inputIdProducto').val(suggestion.data)
$('#inputPrecioUnidad').val(suggestion.precio_unidad);
}
});}
// Repetidor de campos de Productos
$('.repeater').repeater({
hide: function (deleteElement) {
var elemento=$(this);
swal({
title: "Estas Seguro?",
text: "Se borrará toda la fila!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Si, bórralo!",
cancelButtonText: 'Cancelar',
closeOnConfirm: false
}, function(){
swal("Producto Borrado!", "Se ha eliminado el Producto.", "success");
elemento.remove();
sumarTotales();
crearIgv();
});
},
isFirstItemUndeletable: true
});
// ./ Repetidor de campos de Productos
Thank you very much !!