ioshtml-selectonchangeios13.3iphone11

HTML Drop Down not selecting options in iPhone's IOS 13


I implemented a web application and it has a drop down (i.e., HTML Select). If I tried to select any option in the drop down its not triggering the change event but its updates the label text successfully.

Sample Code:

<select id="storagetype">
    <option value="" selected>Select Storage Type</option>
    <option value="1" selected>ABC</option>
    <option value="2" selected>XYZ</option>
</select>

JavaScript:

var storagetype = document.getElementById("storagetype");

storagetype.addEventListener("change", function() {
    alert(storagetype.value)
});

If I tried the same in IOS 12.X or lower version its working as expected.

Moreover there is no console error and I tried the style z-index. But nothing worked.

enter image description here


Solution

  • in below code add filter to detect iphone then use it.

    Javascript:

     document.addEventListener('click', function (params) {
     document.querySelectorAll('li[id^="select-options"]').forEach(ele => {
     ele.addEventListener('touchend', (e) => {
     e.stopPropagation();
       })   
      }); 
    });
    

    Jquery:

    $(document).click(function(){
      $('li[id^="select-options"]').on('touchend', function (e) {
        e.stopPropagation();
      }); 
    });