lundi 15 juin 2020

How to limit checkboxes

Im using a third party plugin called RestroPress to create an online menu. It allows me to create additional items that can be purchased on adding a main item to the menu. This is via a form that loads within a pop-up, although I would like to limit the amount of items they can add, ie The 'Choice of noodle' would only allow one option to be checked and 'Choice of Flavours' would only allow 5 options to be checked.

Unfortunately Im working with the below code and all solutions I have found dont apply to this layout of checkbox/input... Is there a way I can do this via JS or jQuery?

Website link here: order.miss-china

    <form>
<h6>Choice of Noodle</h6>
<div><label for="fat-rice-noodle"><input name="Fat Rice Noodle" type="checkbox" value="58|1||checkbox" data-type="checkbox" />Fat Rice Noodle</label></div>
<div><label for="thin-rice-noodle"><input name="Thin Rice Noodle" type="checkbox" value="57|1||checkbox" data-type="checkbox" />Thin Rice Noodle</label></div>
<div><label for="egg-noodle-contains-gluten"><input name="Egg Noodle (Contains gluten)" type="checkbox" value="56|1||checkbox" data-type="checkbox" />Egg Noodle (Contains gluten)</label></div>

<h6>Choice of Flavours</h6>
<div><label for="fish-choice-of-flavours"><input name="Fish" type="checkbox" value="66|1||checkbox" data-type="checkbox" />Fish</label></div>
<div><label for="beef-choice-of-flavours"><input name="Beef" type="checkbox" value="63|1||checkbox" data-type="checkbox" />Beef</label></div>
<div><label for="prawn-wontons-contains-gluten"><input name="Prawn Wontons (Contains gluten)" type="checkbox" value="60|1||checkbox" data-type="checkbox" />Prawn Wontons (Contains gluten)</label></div>
<div><label for="prawns-choice-of-flavours"><input name="Prawns" type="checkbox" value="65|1||checkbox" data-type="checkbox" />Prawns</label></div>
<div><label for="sliced-bbq-pork-choice-of-flavours"><input name="Sliced BBQ Pork" type="checkbox" value="62|1||checkbox" data-type="checkbox" />Sliced BBQ Pork</label></div>
<div><label for="chicken-choice-of-flavours"><input name="Chicken" type="checkbox" value="64|1||checkbox" data-type="checkbox" />Chicken</label></div>
<div><label for="chicken-dumplings-contains-gluten"><input name="Chicken Dumplings (Contains gluten)" type="checkbox" value="61|1||checkbox" data-type="checkbox" />Chicken Dumplings (Contains gluten)</label>

</div>
</form>



Aucun commentaire:

Enregistrer un commentaire