I have the following conditional jquery function: Is there a way of having an "or" in a conditional? Ideally I want a single function, where if the values are 1,2 or 3 hide the corresponding elements. Is this possible? My goal is just to have more efficient, cleaner code, this seems unnecessarily long and reptitive.
$("#Catalogue").change(function () {
var a = $(this).val();
console.log(a);
if (a == 1) {
$("#DeliveryMethod").hide();
$("#CatalogueID").hide();
}
else if (a == 2) {
$("#DeliveryMethod").hide();
$("#CatalogueID").hide();
}
else if (a == 3) {
$("#CatalogueID").show();
$("#DeliveryMethod").hide();
}
else {
$("#DeliveryMethod").show();
$("#CatalogueID").hide();
}
});