简体   繁体   中英

Datepicker issue in IE11

We are using a jQuery datepicker which is working fine in Chrome and Firefox but we are having issues with IE11, specifically this error:

Object doesn't support property or method 'datepicker'

I expect my code to work fine with IE11 also.

$(document).ready(function() {
  $("#DOB").datepicker({
    dateFormat: "yy-mm-dd",
    changeMonth: true,
    changeYear: true,
    yearRange: "-100:-17",
    onSelect: function(selDate) {
      var selyear = $(".ui-datepicker-year").val();
      seldate = selDate.split('-');
      seldate = selyear + '-' + seldate[1] + '-' + seldate[2];
      $(this).val(seldate);
    }
  });
});

Try to use F12 developer tools to check whether the JQuery UI reference load success.

Besides, please try to use the following JQuery reference:

<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM