-3

This is error patch:

enter image description here

And here is my code for hide modal in iphone device

$(document).ready(function(){
    var modal = $('.myModal', window.top.document); // Works
    modal.on('show.bs.modal', function(e) {
      var width = $(window).width(); 
      var testdevice =  /iPhone/i.test(navigator.userAgent);
      if(testdevice) {
        $(this).modal('toggle');
      }
    });
  });
Pramod Gharu
  • 1,101
  • 3
  • 9
  • 18
Riddhi Busa
  • 88
  • 1
  • 11

1 Answers1

1

Try like this

$(document).ready(function(){
var modal = $('.myModal', window.top.document); // Works
modal.on('show.bs.modal', function(e) {
  var width = $(window).width(); 
  if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    $(this).modal('toggle');
  }
});
});
Shibon
  • 1,295
  • 1
  • 6
  • 19