gpt4 book ai didi

javascript - 如果所选时间位于使用 jquery 的下拉列表中给出的时间范围之间,则显示错误消息

转载 作者:行者123 更新时间:2023-12-03 03:53:46 25 4
gpt4 key购买 nike

如果从下拉列表中选择的时间范围在当前时间之间,则需要显示错误消息。

我有一个日期选择器和交货时间。对于交货时间,我给出了一些时间范围,例如 10-1,1-4,4-7,7-10。如果用户选择今天的日期和时间为 1- 4 然后它应该显示一条验证消息,例如时间段不可用。

日期选择器:

<div><label class="delivery_date_label">' . __( "Delivery Date" ) . ': </label>

<input type="text" id="delivery_calender_lite" name="delivery_calender_lite" class="delivery_calender_lite" style="cursor: text!important;margin-bottom:10px;" readonly/>
</div>

时间选择器:

<div><label class="delivery-hours">' . __( "Delivery Time" ) . ': </label>
<select id="delivery-hours" class="delivery-hours" name="delivery_hour" >
<option value="">'.__("Choose an hour").'</option>
<option value="10am-1pm">10AM-1PM</option>
<option value="1pm-4pm">1PM-4PM</option>
<option value="4pm-7pm">4PM-7PM</option>
<option value="7pm-10pm">7PM-10PM</option>

</select>
</div>

最佳答案

试试这个,我想这会起作用。但你必须使用 jQuery。我在其中使用了 bootstrap date picker,但我认为它也可以与您的插件一起正常工作。干杯..!

<强> JsFiddle

关于javascript - 如果所选时间位于使用 jquery 的下拉列表中给出的时间范围之间,则显示错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45052586/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com