CarlosZ
CarlosZ

Reputation: 73

Html5 <datalist> issue on chrome

I'm working with a dynamic datalist that are dependent on each other, my problem is that work perfectly in firefox but not in google chrome, loading the third of 5 total therefore does not load the data.

my html for some because it´s many code:

<label for="cod_miembro" class="col-sm-2 control-label">Miembro</label>
    <div class="col-sm-2">
    <input type="text" class="form-control" size="25" maxlength="25" name="codmiembro"id="cod_miembro" list="miembros" placeholder="Miembro"/>
    <datalist id="miembros">
    </datalist>
</div>`

and i'm load with Jquery:

$("#cod_miembro").ready(function(e) 
{
    var val = $(this).val();
    if(val != "") return;
    console.log(val);
    $.get(
    ruta, 
    {operacion:'BuscarMiembros'}, 
    function(resultado) 
    {
    var dataList_miembro = $("#miembros");
    dataList_miembro.empty();
    if(resultado.raiz.length) 
    {
    for(var i=0, len=resultado.raiz.length; i<len; i++) 
    {
    var opt = $("<option></option>").attr("value", "( "+resultado.raiz[i]['id_miembro']+" ) "+resultado.raiz[i]['nom_miembro']);
    dataList_miembro.append(opt);
    }
    $("#cod_departamento").attr('disabled', false);
}
},
"json");
});

in firefox works very well but not in chrome.

Thanks for your help.

Upvotes: 3

Views: 7354

Answers (1)

CarlosZ
CarlosZ

Reputation: 73

Solved, If the size of datalist tag it´s not acording your returned data, the datalist will not respond on Google Chrome. I've resolve this expand the size of input from size="25" to size="45".

Upvotes: 1

Related Questions