I have a PHP Query that returns MYSQL table results in the form of Checkbox Inputs as such...
<input type="checkbox" name="deli_meat[]" id="<? echo $rows['itemname']; ?>" value="<? echo $rows['label']; ?>" />
In addition, each checkbox has an associated SELECT box that becomes visible anytime one of the checkboxes in checked.
<select id="<? echo $rows['itemname']; ?>" class="weight" style="display:none"><option disabled selected value> -- Select Quantity -- </option>
<option value="1">1</option>
<option value="2">2</option>
</select>
I do this with jquery like this
$("input[name$='deli_meat[]']").change(function() {
var e = $(this).val();
$(this).is(":checked") ? $(".weight[id='" + e + "']").show() : $(".weight[id='" + e + "']").hide()
}),
My Goal
I am would to make it so, when someone clicks a checkbox and it's associated select box becomes visible, that they MUST make a selection before clicking ANY other checkbox. Any ideas how I can accomplish this.
Aucun commentaire:
Enregistrer un commentaire