I have an input as type="time" when user click to select a time, I would like to disable some of time stamps for example 8:30 and 10:30 be disabled and user be not able to choose them. Preferably with JavaScript or css if possible.
Any idea how to do it?
<form action="/action_page.php">
<label for="appt">Select a time:</label>
<input type="time" id="appt" name="appt">
<input type="submit" value="Submit">
</form>
Edited:
After getting a suggestion with this link
I decided to use <dataList> as below, when I disable the option they disappear from list what is unsuitable for my cass.
Any suggestion why it disappear instead of disabling?
<input type="time" id="appt" name="appt" list="time-list">
<datalist id="time-list" >
<option id="08" name="08" value="08:30" datatype="time" disabled>
<option id="09" name="09" value="09:30" datatype="time" >
<option id="10" name="10" value="10:30" datatype="time">
<option id="11" name="11" value="11:30" datatype="time" disabled>
<option id="13" name="13" value="13:30" datatype="time" >
<option id="20" name="20" value="20:30" datatype="time">
</datalist>