我有两个函数,我想用来缩小我的jQuery Datepicker中的选择范围。我被困在如何结合这两个功能,所以我可以结合使用它们。现在我先放哪一个优先,另一个不行。结合jQuery datepicker函数
//the html
<input type="text" class="input-text hasDatepicker" name="order_delivery_date" id="datepicker" placeholder="Select Date" value="">
//two functions, whichever one is first works
<script type="text/javascript">
jQuery(function ($) { $("#datepicker").datepicker({ minDate: "+1", maxDate: "+1M +10D" }); });
jQuery(function ($) { $("#datepicker").datepicker({beforeShowDay: function(date){ return [date.getDay() != 2, '']; }})});
</script>
// my attempt to combine them, not working
<script type="text/javascript">
jQuery(function ($) {
$("#datepicker").datepicker({ minDate: "+1", maxDate: "+1M +10D" });
$("#datepicker").datepicker({beforeShowDay: function(date){ return [date.getDay() != 2, '']; }});
});
</script>
它是如何工作的?详细信息... –
一个函数限制选择一周中的某一天,在这种情况下,它是第2天或周二。另一个函数设置最小/最大日期范围。我知道他们不一起工作,因为当最小/最大功能是第一时间的时候,我仍然可以选择星期二,当不用星期二功能时,我可以选择没有混合/最大的任何日期。 –