Changing startDate and endDate params of BootStrap Datepicker on change of a select Box

后端 未结 2 489
面向向阳花
面向向阳花 2021-01-15 12:26

What I am trying to do :

I am trying to set the startDate and endDate params depending on the current value of year. I think that currenty what I have just sets the

2条回答
  •  北海茫月
    2021-01-15 12:34

    Change the values of option 2013-2014 and 2015-2016 like

    
    

    Change this to js,

    var myStartDt;
    function mydatepicker(){
       myStartDt= $('#myStartDate')
            .datepicker({
            startDate: getStartDate(),
            endDate: getEndDate()
        }).on('changeDate', function (ev) {
            myStartDt.hide();
        }).data('datepicker');
    }
     $("#mySelect").on('change',function(){
        // alert(this.value)
        $('#myStartDate').datepicker("remove");
        mydatepicker();//$('#id-element').datepicker("destroy");
    });
    mydatepicker();
    

    Fiddle

提交回复
热议问题