Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.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
Javascript 选择第一个日期后禁用过去日期日期选择器_Javascript_Jquery_Html_Datepicker - Fatal编程技术网

Javascript 选择第一个日期后禁用过去日期日期选择器

Javascript 选择第一个日期后禁用过去日期日期选择器,javascript,jquery,html,datepicker,Javascript,Jquery,Html,Datepicker,我正在努力制作一个简单的预订表单,使用GET重定向到staah预订引擎(他们没有任何api或嵌入式小部件) 预订引擎只接受“dd-M-yyy”日期格式(如2018年4月19日) 我搜索了这么多,但没有找到任何有效的解决方案,最近我发现了工作小提琴,我编辑了我的需要小提琴(你会知道我想在小提琴实现什么)。你可以在这里看到: 但问题是他们对HTML代码有不同的处理方法,我尝试过修改我的HTML的js代码,但没有效果。我在javascript方面没有任何技能。我不知道为什么这个提琴在我的html代码中

我正在努力制作一个简单的预订表单,使用GET重定向到staah预订引擎(他们没有任何api或嵌入式小部件)

预订引擎只接受“dd-M-yyy”日期格式(如2018年4月19日)

我搜索了这么多,但没有找到任何有效的解决方案,最近我发现了工作小提琴,我编辑了我的需要小提琴(你会知道我想在小提琴实现什么)。你可以在这里看到: 但问题是他们对HTML代码有不同的处理方法,我尝试过修改我的HTML的js代码,但没有效果。我在javascript方面没有任何技能。我不知道为什么这个提琴在我的html代码中不起作用

我的代码

<div class="col-md-2 col-sm-3">
<div class="input-group date" >
<input type="text" class="jaraksmall sm-form-control form-control from " id="from" name="from" required>
</div>

</div>
<div class="col-md-2 col-sm-3">
<div class="input-group date"> 
<input type="text" class="jaraksmall sm-form-control form-control to" id="to" name="to" required>
</div>

fiddle html代码:

<div class="line col-sm-4">
<div class="form-group">
<label>First check in:</label>
<input type="text" class="form-control form-control-1 input-sm"placeholder="CheckIn" >
</div>

<div class="form-group">
<label>First check out:</label>
<input type="text" class="form-control form-control-2 input-sm" placeholder="CheckOut">
</div>
</div><!--line-->    

首次入住:
第一次退房:
如何使来自fiddle的js代码在我的html代码中运行良好?
很抱歉我的英语不好,这是因为
的选择器。查找输入元素的每个
和选择器都没有找到所需的元素。您需要:

1) 删除每个语句

2) 修改datepicker输入元素选择器以使用已添加的类(到和来自)


您也可以按如下方式替换html代码

<div class="line" style="width:100%">
<div class="col-md-2 col-sm-3" style="display: inline-block">
<div class="input-group date" >
<input type="text" class="jaraksmall sm-form-control form-control-1 form-control from " id="from" name="from" required>
</div>
</div>

<div class="col-md-2 col-sm-3" style="display: inline-block">
<div class="input-group date"> 
<input type="text" class="jaraksmall sm-form-control form-control-2 form-control to" id="to" name="to" required>
</div>
</div>
</div>


我的表单是水平的,我已经测试了你的答案,但用另一个div将列包装起来会使我的输入中断(垂直)或变得丑陋。有没有建议避免使用div或js中的每个div?我的表单是水平的,我已经测试了你的答案,但是用另一个div包装列会使我的输入中断(垂直)或很难看。有没有建议避免在js中使用div或each?
<div class="line" style="width:100%">
<div class="col-md-2 col-sm-3" style="display: inline-block">
<div class="input-group date" >
<input type="text" class="jaraksmall sm-form-control form-control-1 form-control from " id="from" name="from" required>
</div>
</div>

<div class="col-md-2 col-sm-3" style="display: inline-block">
<div class="input-group date"> 
<input type="text" class="jaraksmall sm-form-control form-control-2 form-control to" id="to" name="to" required>
</div>
</div>
</div>