Check if multiple select options contain a certain value
Hello, I have a multiple select (id="machApp") and I need to check if the option "other" has been chosen as standalone value OR in addition to other options and, if "yes", do some actions (hide or show an element (id ="machAppSpec")).
For a similar task in a single select I use the following code that works fine:
- $('#machApp').change(function() {
if ($(this).val() == 'other') {
$("#machAppSpec").show();
} else {
$("#machAppSpec").hide();
}
});
However this code does not work for multiple select due to the fact that when the "other" option is selected IN ADDITION to other options the test turns to false while I need to have true also in this case.
Which code should I use to say that the chosen options "contain" "other"?
Thanks