Why isn't Jquery date picker icon showing in I

2019-08-30 04:01发布

I have the following code in my html page. The icon exists and the path to the image is valid. Every browser seem to display this correctly except IE8 which only shows a rey box. Does anyone know a way around that?

<script type="text/javascript" charset="utf-8">

 var sDate = new Date(1323637200000);

  $(function() {
    $( "#datepicker" ).datepicker({

      minDate: -151,
      maxDate: "-1D",
      dateFormat: "dd-mm-yy",
      defaultDate: sDate,
      firstDay: 6,
      showOn: "button",
      buttonImage: "/public/images/ico-calendar.gif",
      buttonImageOnly: false,
      onSelect: function(mydate) {
            window.location.href="/reports/"+mydate;
        }
    });
  });
</script>
<input type="hidden" id="datepicker" />

2条回答
ら.Afraid
2楼-- · 2019-08-30 04:45

After a lot of fiddling I discovered that resetting the maximum width on the icon image allowed the icon to appear correctly. That sounds like a quirk with IE 8.

img{
 max-width: none;
}
查看更多
The star\"
3楼-- · 2019-08-30 04:50

change the html to

<input type="text" id="datepicker" />

Fiddle here. I have not given a valid image path. You need to check it on your dev system.

查看更多
登录 后发表回答