Based on the example of Irwin Dominin, I created 2 examples that support insertion and pressed Enter.
This works in Chrome: http://jsfiddle.net/lhernand/0a8woLev/
$(document).ready(function() { $('#date-daily').datepicker({ format: 'dd/mm/yyyy', assumeNearbyYear: true, autoclose: true, orientation: 'bottom right', todayHighlight: true, keyboardNavigation: false }) .on('paste', function(e) { $(this).blur(); $('#date-daily').datepicker('hide'); }) .on('keydown', function(e) { if (e.which === 13) { console.log('enter'); $(this).blur(); } }) .change(function(e) { console.log('change'); $('#stdout').append($('#date-daily').val() + ' change\n'); }); });
But not in IE, so I created another example for IE11: https://jsbin.com/timarum/14/edit?html,js,console,output
$(document).ready(function() { $('#date-daily').datepicker({ format: 'dd/mm/yyyy', assumeNearbyYear: true, autoclose: true, orientation: 'bottom right', todayHighlight: true, keyboardNavigation: false }) // OnEnter -> lose focus .on('keydown', function(e) { if (e.which === 13){ $(this).blur(); } }) // onPaste -> hide and lose focus .on('keyup', function(e) { if (e.which === 86){ $(this).blur(); $(this).datepicker('hide'); } }) .change(function(e) { $('#stdout').append($('#date-daily').val() + ' change\n'); }); });
If the last example still does not work in IE11, try to split the setup:
// DatePicker setup $('.datepicker').datepicker({ format: 'dd/mm/yyyy', assumeNearbyYear: true, /* manually-entered dates with two-digit years, such as '5/1/15', will be parsed as '2015', not '15' */ autoclose: true, /* close the datepicker immediately when a date is selected */ orientation: 'bottom rigth', todayHighlight: true, /* today appears with a blue box */ keyboardNavigation: false /* select date only onClick. when true, is too difficult free typing */ });
And event handlers: (note, I am not using $('.datepicker').datepicker({ )
// Smoker DataPicker behaviour $('#inputStoppedDate') // OnEnter -> lose focus .on('keydown', function (e) { if (e.which === 13){ $(this).blur(); } }) // onPaste -> hide and lose focus .on('keyup', function (e) { if (e.which === 86){ $(this).blur(); $(this).datepicker('hide'); } }) .change(function (e) { // do saomething });