javascript - jQuery DatePicker disappears when i click Next/Previous buttons -
my project has datepicker has buttons go previous/next months. looks this:
but when click buttons on right , left corner of control, disappears.
jquery function:
$( "#departdate" ).datepicker({ showothermonths: true, //inline:true, dateformat: 'dd-mm-yy', numberofmonths: 2, selectothermonths: true, mindate: 0, onclose: function (selecteddate) { $("#arrivedate").datepicker("option", "mindate", selecteddate); if (!single && $("#arrivedate").val()=="") $("#arrivedate").focus(); } });
i tried comment out onclose:
, mindate
none of these fixed problem.
when remove blur function on datepicker, stops disappearing. need make disappear when click anywhere out of tool.
you should add click event check elements in datepicker. might useful you:
$(document).on("click", function (e) { var elem = $(e.target); if (!elem.hasclass("hasdatepicker") && !elem.hasclass("ui-datepicker") && !elem.hasclass("ui-icon") && !elem.hasclass("ui-datepicker-next") && !elem.hasclass("ui-datepicker-prev") && !$(elem).parents(".ui-datepicker").length) { $('#departdate').datepicker('hide'); }
Comments
Post a Comment