I am aware of this post, but .endsWith
doesn't seem to resolve it, as it has to contain .val
in order to work for dropdown. I am dealing with multiple languages for different dropdowns, where the word "English" appears in different translations. indexof > 0
is not pracitcal with so many languages.
If it is a duplicate, please point out for me where to look at, so I can carry on. Thanks!
I have the following jQuery comparison for dropdown values:
$(".languages").change(function () {
if ($(".languages").val() == "English (UK)"||$(".languages").val() == "English (US)") {
$(".selected-1").show();
$(".unselected-1").hide();
}
else $(".unselected-2").show() && $(".unselected-1").hide();
});
Due to the fact that I deal with multiple different languages for the word "English", I am looking for a wildcard in this case. So why is the following not possible, or how do I optimize this?
$(".languages").change(function () {
if ($(".languages").val() == "* (UK)"||$(".languages").val() == "* (US)") {
$(".selected-1").show();
$(".unselected-1").hide();
}
else $(".unselected-2").show() && $(".unselected-1").hide();
});