javascript - jQuery DatePicker disappears when i click Next/Previous buttons -


my project has datepicker has buttons go previous/next months. looks this: enter image description here

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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -