Why isn't Jquery date picker icon showing in IE8?

非 Y 不嫁゛ 提交于 2019-12-12 02:08:46

问题


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" />

回答1:


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;
}



回答2:


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.



来源:https://stackoverflow.com/questions/8488571/why-isnt-jquery-date-picker-icon-showing-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!