0
$('#datePicker').datepicker({
    language: "fr",
    backdrop: 'static',
    keyboardNavigation: false,
    calendarWeeks: true,
    todayHighlight: true,
    format: 'dd/mm/yyyy',
    endDate: '+0d',
});
Sinto
  • 3,915
  • 11
  • 36
  • 70
Vishal Patel
  • 31
  • 1
  • 5
  • $('#datePicker').datepicker({ language: "fr", backdrop: 'static', keyboardNavigation: false, calendarWeeks: true, todayHighlight: true, format: 'dd/mm/yyyy', endDate: '+0d', }); – Vishal Patel Sep 12 '18 at 12:17
  • https://stackoverflow.com/questions/16693079/how-to-disable-escape-key-for-twitter-bootstrap-modals – mplungjan Sep 12 '18 at 12:19
  • Possible duplicate of [How to disable Escape Key for Twitter Bootstrap Modals?](https://stackoverflow.com/questions/16693079/how-to-disable-escape-key-for-twitter-bootstrap-modals) – Vikasdeep Singh Sep 12 '18 at 12:20
  • Neither of those questions are even close to duplicates of this one. – Skeets Apr 09 '19 at 00:55

1 Answers1

1

I believe you are referring to this library?

If that's the case, it looks like there isn't any option to disable the escape button.

I'd recommend using Bootstrap datetimepicker instead. It has more options, and if you only need the date and not the time, it can do that too.

To disable the escape key binding (along with keyboard navigation, since you had that disabled as well), you'd just do this:

$("#your-element").datetimepicker({
  keyBinds: {
    escape: null,
    up: null,
    down: null,
    right: null,
    left: null
  }
});
Skeets
  • 4,476
  • 2
  • 41
  • 67
  • 1
    Great. Thank you :) – Clox Sep 29 '20 at 18:51
  • 1
    The datetimepicker of eonasdan is not maintained anymore and it is not compatible with bootstrap 4. However https://tempusdominus.github.io/ is a continuation of the former one so it is basically the same deal with the same syntax and everything but compatible with bootstrap 4. – Clox Oct 17 '20 at 18:09