Jquery: DatePicker: start/end date

前端 未结 3 628
太阳男子
太阳男子 2020-12-12 01:29

i have looked around before posting my question

following what i am looking in my datepicker (start date and end date):

1) Start date: can b

3条回答
  •  伪装坚强ぢ
    2020-12-12 02:06

    I prefer to write a default configuration for the datepicker using a class so that it works with more than one with less duplicates.

    onSelect: function(dateText, inst){
        // Check if _until exists and auto set mindate
        if(inst.id.contains("_from")){
            $("#"+inst.id.replace("_from", "_until")).datepicker("option", "minDate", dateText);
        }
    }
    

    This works assuming your form IDs are consistent. E.g I use date_until and date_from

提交回复
热议问题