help with autocomplete in dynamically created elements

3

I appeal to you because I have not been able to implement the autocomplete in dynamically created elements with jquery, I do it in the following way.

$('#addMarcaTabla').click(function () {       
    var html = '';
    html += '<tr class="itemMarcasAgregadas">';
    html += '<td><input type="text" class="form-control denominacion" placeholder="Marca /Den. Distintiva"/><span class="error">Es Requerido</span></td>';
    html += '<td><input type="text" class="form-control registroSanitario" placeholder="Núm. Registro Sanitario"/></td>';
    html += '<td><input type="text" class="form-control rfcTitular searchInput" placeholder="Titular Registro Sanitario"/></td>';
    html += '<td><input type="text" class="form-control procedencia" placeholder="Procedencia"/></td>';
    html += '<td><input type="text" class="form-control fabricante" onBlur="GetRazonSocial(this);"  placeholder="Fabricante"/></td>';
    html += '<td><button type="button" name="removeMarcaTemp" class="btn btn-danger btn-sm removeMarcaTemp"><span class="glyphicon glyphicon-trash"></span></button></td>';
    html += '</tr>';
    $('#tblMarcasTemp').append(html);
    itemMarca = itemMarca + 1;
    if (itemMarca != 0)
    {
        $('#submit').show();
    }               
});

and my event to be able to add the event to the input with the searchInput class is as follows.

$('.searchInput').autocomplete({
    source: _urlBase + "Ofertas/GetProcedimientos",
    select: function (event, ui) {
        $("#MtoProveedorId").empty();
        GetProveedoresConOferta(ui.item.id);
        id = (ui.item.id);
        $("#MtoProcedimientoId").val(ui.item.id);
    }
})

However, it does not show any errors but it does not show the results either.

    
asked by Horacio Xochitemol 30.01.2018 в 21:23
source

0 answers