lundi 8 avril 2019

Conditional on Multi Select for certain options only

I have a multiselect where I need to show/hide another select based on options selected in the first select. There are 3 options that should cause the other select to appear - all other options should not cause anything to change.

I have it working if individually the options are selected. However if one of the options is selected along with any other options it doesn't work.

DUE to CMS constraints I am unable to add classes to the options.

This is my current jQuery code.

$('#freeform_how_would_you_best_describe_your_companys_research_activity').change(function() {

            var selectedItems

            if ($(this).val() == 'Drug Discovery/Development' || $(this).val() == 'Therapeutics' || $(this).val() == 'Vaccines' ) {
                $('label[for="freeform_tell_us_more_about_your_research_activity"], select#freeform_tell_us_more_about_your_research_activity').slideDown();
            } else {
                $('label[for="freeform_tell_us_more_about_your_research_activity"], select#freeform_tell_us_more_about_your_research_activity').slideUp();
            }
        });

Please advise

Aucun commentaire:

Enregistrer un commentaire