Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery日期选择器到日期_Jquery_Jquery Ui - Fatal编程技术网

jquery日期选择器到日期

jquery日期选择器到日期,jquery,jquery-ui,Jquery,Jquery Ui,我正在使用jquery日期选择器。 我必须输入起始日期和截止日期等字段。 因此,在to date中,from date应作为日期选择器中的最小值显示 <input class="user-reg-input fl" type="text" name="Duration_From[]" id="Duration_From1" value="" maxlength="25" style="width:117px;" /> <input class="user-reg-input f

我正在使用jquery日期选择器。 我必须输入起始日期和截止日期等字段。 因此,在to date中,from date应作为日期选择器中的最小值显示

<input class="user-reg-input fl" type="text" name="Duration_From[]" id="Duration_From1" value="" maxlength="25" style="width:117px;" />
<input class="user-reg-input fl" type="text" name="Duration_To[]" id="Duration_To1" value="" maxlength="25" style="width:117px;" />

您可以试试


$('.user reg input').datepicker();
$('.user reg input.dt from')。on('change',function(el){
console.log($(el.currentTarget.next())
$(el.currentTarget).next().datepicker('option','minDate',$(el.currentTarget).val())
})

这是我的项目中的一个工作代码片段。

hook@
。更改
并调整交易对手的范围。请您更具体一点,如果用户选择的日期是1991年9月12日,则截止日期必须提前10年
<input class="user-reg-input fl dt-from" type="text" name="Duration_From[]" id="Duration_From1" value="" maxlength="25" style="width:117px;" />
<input class="user-reg-input fl dt-to" type="text" name="Duration_To[]" id="Duration_To1" value="" maxlength="25" style="width:117px;" />

$('.user-reg-input').datepicker();

$('.user-reg-input.dt-from').on('change', function(el){
    console.log($(el.currentTarget).next())
    $(el.currentTarget).next().datepicker('option', 'minDate', $(el.currentTarget).val())
})
$(function() { 
$( "#Duration_From1" ).datepicker({
    showOn: "both",
    buttonImage: CONTEXT_PATH + "/images/icon_calendar.png",
    buttonImageOnly: true,
    minDate: new Date(),
    dateFormat: 'dd/mm/yy',
    onSelect: function(dateText,inst){
        $( "#Duration_To1" ).datepicker("option","minDate",new Date(inst.currentYear,inst.currentMonth,parseInt(inst.currentDay)));
        $( "#Duration_To1" ).val(dateText);
    }
}); 
});