Select Multiple Materialize no mobile

0

I have a question on select multiple from Materialize for mobile. I can not select another option, other than Bootstrap that when clicking outside the field, it exits automatically.

Has anyone ever had anything like this?

/* Select */
 $(document).ready(function() {
  $('select').material_select();
});
<h5 class="margintext">Pesquise seu imóvel</h5>
            <div class="input-field col s12 m4 l3">
              <select multiple>
                <option value="" disabled selected>Finalidade</option>
                <option value="1">Venda</option>
                <option value="2">Aluguel</option>
                <option value="3">Aluguel temporada</option>
              </select>
            </div>

            <div class="input-field col s12 m4 l3">
              <select multiple>
                <option value="" disabled selected>Cidades</option>
                <option value="1">Capão da Canoa</option>
                <option value="2">Porto Alegre</option>
                <option value="3">Imbé</option>
                <option value="3">Caxias</option>
              </select>
            </div>

            <div class="input-field col s12 m4 l3">
              <select multiple>
                <option value="" disabled selected>Bairros</option>
                <option value="1">Cetro</option>
                <option value="2">Zona Nova</option>
                <option value="3">Navegantes</option>
              </select>
            </div>

    
asked by anonymous 17.10.2017 / 21:58

1 answer

0

Anyone with the same problem just paste this script

$(document).on('touchstart', function (e) {
    let target = $(e.target);
    if (!target.is("span")) { //checking if you are tapping on items in multiple select or not
        $(document).trigger('click'); //if you are tapping outside multiple select close it
        $(':focus').blur(); //focus out for multiple select so you can choose another or the same (in case you have more multiple selects on page)
    } else {
        //nothing or fire another event
    };
});
    
06.11.2017 / 20:51