HTMLフォームをJSONに要約するのに苦労しています。私は利用可能な時間にしか興味がないので、無効になっている値は欲しくない。JSONへのHTMLフォームの解析
console.log($(".venue input:enabled"))
// Ideally it could be in a JSON object like:
// { 2: [ "07:00AM", "01:00PM", "02:00PM"], ... }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="venue">
<h4>Court 2</h4>
<div>
<div>
<input type="checkbox" name="timeslots[]" id="534584">
<label for="534584">07:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>08:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>09:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>10:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>11:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>12:00 PM</label>
</div>
<div>
<input type="checkbox" name="timeslots[]" id="534590">
<label for="534590">01:00 PM</label>
</div>
<div>
<input type="checkbox" name="timeslots[]" id="534591">
<label for="534591">02:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>03:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>04:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>05:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>06:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>07:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>08:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>09:00 PM</label>
</div>
</div>
</div>
<div class="venue">
<h4>Court 3</h4>
<div>
<div>
<input type="checkbox" name="timeslots[]" id="534584" disabled>
<label for="534584">07:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>08:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>09:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>10:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>11:00 AM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>12:00 PM</label>
</div>
<div>
<input type="checkbox" name="timeslots[]" id="534590">
<label for="534590">01:00 PM</label>
</div>
<div>
<input type="checkbox" name="timeslots[]" id="534591">
<label for="534591">02:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>03:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>04:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>05:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>06:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>07:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>08:00 PM</label>
</div>
<div>
<input type="checkbox" disabled="">
<label>09:00 PM</label>
</div>
</div>
</div>