Bootstrap datepicker not close automatically after picking a date

前端 未结 12 1652
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 12:41

I use the latest Bootstrap datepicker.js. All works fine except that when I pick a date from the drop down, it does not automatically close it. I searched web and tried to u

12条回答
  •  被撕碎了的回忆
    2020-12-24 13:30

    When you hover over the div with the class defaultdatepicker. The calendar control will appear. On Mouseleave it will dissapear.

     $(document).on("focus", ".defaultdatepicker", function () {
    
            $(this).datepicker({
                format: 'dd/mm/yyyy',
                todayHighlight: 'TRUE',
                autoClose: true,
            });
    
            $('#datepicker').css({ "opacity": "1" });
        });
    
        $('.defaultdatepicker').on('mouseleave', function () {
            $('.datepicker').fadeOut(function () {
                $('.formattedStartDate').attr('class', 'formattedStartDate');
    
                $('#datepicker').css({ "opacity": "0" });
            });
        });
    

提交回复
热议问题