javascript - Avoid reopen datepicker after date selection in internet explorer -
when select date, datepicker reopen because added $(this).focus(); in onselect. how can resolve issue? (example)
$('#datepicker').datepicker({ onselect : function(x, u){ $(this).focus(); } });
i want focus must. cannot remove focus. please tell me solution without removing focus.
please note after jquery ui datepicker selection, blur , change events fire before focus returned input field, there problem focus event on ie.
the fix given below
//example using triggerhandler $(function () { "use strict"; $('#datepicker').datepicker({ onselect : function(x, u){ format: "dd/mm/yyyy" }, onclose: function(datetext) { $(this).triggerhandler("focus"); $(this).triggerhandler("blur"); } }); });
this work me, refer
//example using triggerhandler http://jsfiddle.net/shaikhimran786/w6fvul18/
use triggerhandler solve issue.
the triggerhandler() method triggers specified event selected element.
this method similar trigger() method, except trigger() triggers default behavior of event (like form submission).
and solution
//example using hide datepicker $(function () { "use strict"; $('#datepicker').datepicker({ onselect : function(x, u){ format: "dd/mm/yyyy" } }); $('.dp').on('change', function () { $('.datepicker').hide(); }); });
refer below link for
//example using hide datepicker http://jsfiddle.net/shaikhimran786/xj9tkvtd/
hope fix solve problem.
Comments
Post a Comment