I have html form (Start Time - End Time) time picker. I want when user for example selects Start date 11:00, End date should become +1 hour 12:00 in our example and previous hours should be disable.
I made something but it only makes previous hours disabled and in end date I get same hour which I select in start date. Here is the code:
<script>
$("select[name='from_time']").on("change", function(){
$("select[name='to_time']").empty();
var startix = $("select[name='from_time'] option:selected").index();
$("select[name='from_time'] option").each(function(ix, el){
if (ix >= startix) {
$(this).clone().appendTo("select[name='to_time']");
}
});
});
</script>