Highlight certain dates on bootstrap-datepicker

后端 未结 5 621
耶瑟儿~
耶瑟儿~ 2020-12-18 23:06

I\'m using the bootstrap-datepicker to check the days where my website got sales and I want to display or highlight the dates there was at least one sale. I can pass the dat

5条回答
  •  旧巷少年郎
    2020-12-18 23:20

    Using datetimepicker events show, update and change the date need to be highlighted.

    The Blog post here explaining how it can achieve using Bootstrap Datetimepicker.

    $('#datetimepicker').on('dp.show', function(e){
      highlight()
    })
    $('#datetimepicker').on('dp.update', function(e){
     highlight()
    })
    $('#datetimepicker').on('dp.change', function(e){
        highlight()
    })
    
    function highlight(){
     var dateToHilight = ["04/19/2019","04/20/2019","04/30/2019"];
     var array = $("#datetimepicker").find(".day").toArray();
     for(var i=0;i -1) {
           array[i].style.color="#090";
           array[i].style.fontWeight = "bold";
        } 
     }
     }
    

    For more information see the blog

    Reference:

    https://sourcecodezoneseven.blogspot.com/2019/04/here-is-code-function-hilight-var.html

提交回复
热议问题