Disable enter key in JQuery ui datepicker -
there seems bug jquery ui datepicker, when user manually enters date, , hits enter, datepicker closes focus stays on field , therefor calendar won't open 1 time again until textbox loses focus , gets again. how can supress come in key behavior? or there other known solutions seemingly known bug? thanks!
edit
after working on bit more, solution came with:
$('#someid').bind('keydown', function(event) { if (event.which == 13) {var e=jquery.event("keydown"); e.which = 9;//tab e.keycode = 9; $(this).trigger(e); homecoming false; } });
the tab key works , prevents default behavior of datepicker's come in key event selecting today's date in cases.
try this
$(document).keydown(keydownhandler); // utilize appropriate selector keydown handler function keydownhandler(e) { if(e.keycode === 13) { e.stoppropagation(); e.preventdefault(); homecoming false; } }
e.stoppropagation
prevents bubbling, e.preventdefault
prevents default behaviour , returning false too, think.
you should have works best: keyup
, keydown
or keypress
.
jquery jquery-ui uidatepicker keyboard-events
No comments:
Post a Comment