How do I apply two different classes? I have two HTML select fields where the user can choose either repair or another option in the first one. When the user selects one, the second field should appear. But it also needs to have a Bootstrap class: form-control.
<script>
$(function() {
$("#correctiemaatregelen").on("change", function() {
var select_val = $(this).val();
console.log(select_val);
if (select_val === 'Other') {
$("#leveranciers").removeClass("hidden");
document.getElementById("leveranciers");
}
else if (select_val === 'Repair') {
$("#leveranciers").removeClass("hidden");
document.getElementById("leveranciers");
}
else {
$("#leveranciers").addClass("hidden");
$("#leveranciers").val("");
}
});
});
</script>
Correctie maatregelen:<br>
<select name="correctiemaatregelen" class="form-control" id="correctiemaatregelen" style="width: 300px">
<option value="--Correctie maatregel--">--Correctie maatregel--</option>
<option value="Use">Use</option>
<option value="Repair">Repair</option>
<option value="Return">Return</option>
<option value="Other">Other</option>
</select>
<br>
<select name="leveranciers" id="leveranciers" class="form-control hidden" style="width: 300px">
<?php while ($row4 = mysqli_fetch_assoc($result4)):; ?>
<option value="<?php echo $row4['statusname'];?>"><?php echo $row4['statusname'];?></option>
<?php endwhile;?>
</select>
Can anyone assist me with this (simple) issue?