This code is working fine if ($(this).val() == \"Spine\")
but if ($(this).val() == \"Spine\"||\"Brian\")
then the selection menu closes then opens
You have wrong syntax in using the logical or ||
operator
Change
if ($(this).val() == "Spine"||"Brain") {
To
if ($(this).val() == "Spine"|| $(this).val() == "Brain") {
You can use value with javascript object instead of val() of jquery object, as Fabrício Matté suggested. It would give you performance benefit.
if (this.value == "Spine" || this.value == "Brain")