Skip to content
Advertisement

How to hide 4 hours ahead in select option

JavaScript

This is the code I am using and

JavaScript

I want to add two more steps: Let’s say a user comes at 10 am and try to pick a time slot I want to disable the time from 10 am – 2 pm whatever is in between this time need to be disabled is that possible?

If the current time is 10 am how do I disable 09:00 and 09:30

Desired output:

If the user comes at 10 am I want to disable 4 hours ahead so I want to disable 10:30, 11:00, 11:30, 12:00, 12:30 13:00, 13:30, 14:00 and 14:30

Advertisement

Answer

I have skipped old time and time from 10 am to 2 PM, Please check the below code

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement