switch (selectedRadioVal) {
case CARD_ORDER_FIELDS:
case CARD_ORDER_IDS:
var items = currentSelect.getElementsByTagName("option");
if (items.length == 0) {
$('#txtCardOrderField').focus();
return;
}
//something like this:if (CARD_ORDER_FIELDS)do this; else do that;
}
As you can see I’m trying to perform the same operation if the value of the switched statement equals CARD_ORDER_FIELDS or CARD_ORDER_IDS, except for the last line. Is it possible to check the current value inside this block and perform some part of the code based on that value?
Simply call an if statement inside the switch:
In full: