Hopefully this should be quite a quick one!
I have a list of <select>
elements on my page. Each of these drop-downs is a list of booking times for an online parents evening booking system.
Each select looks like this:
<select class="appointments" id="14" name="appointments[]">
<option>.. Select:</option>
<option value="1">[ 4:00 ]</option>
<option value="2">[ 4:05 ]</option>
<option value="3">[ 4:10 ] Eliza Fox</option>
<option value="4">[ 4:15 ]</option>
<option value="5">[ 4:20 ]</option>
<option value="6">[ 4:25 ] diane davison</option>
<option value="7">[ 4:30 ]</option>
<option value="8">[ 4:35 ]</option>
<option value="9">[ 4:40 ]</option>
<option value="10">[ 4:45 ]</option>
</select>
Depending on who has booked and who hasn't. The value
integers are the booking slot specific to that time.
I don't want parents to be able to book two appointments at the same time, so I was thinking I could use jQuery to get an array of the value
of each <select>
element, then see if there are any duplicates.
If duplicates are found, I'd like to stop the form from being submitted and display an alert
.
Thanks in advance,