Select dynamic option

0

I have input:text with datepicker .

Selecting the date, it is sent via ajax and returned values in Json. All right so far, it works perfectly here on the desktop using chrome.

But on the iphone, which is most important, these results do not change dynamically in select option .

Here is the code used:

$(function() {
    $('input[name="data"]').datepicker({
        startDate: '<?php echo date('d-m-Y'); ?>',
        format: 'dd-mm-yyyy',
        daysOfWeekDisabled: '0,6',
        language: 'pt-BR',
        todayHighlight: true,
        autoclose: true,
    }).on('change', function(){

        var select_element = document.getElementById('hora');
        select_element.innerHTML = "";
        /// Exemplo simples do resultado em Json.
        var data = {'0':'22:00','1':'22:30','2':'23:00','3':'23:30'};
            $.each(data, function(key, valor) {
                var opt = document.createElement('option');
                opt.value = valor;
                opt.innerHTML = valor;
                select_element.appendChild(opt);
            });
        $('.datepicker').hide();

    });
});
    
asked by anonymous 09.08.2017 / 03:56

0 answers