Hide a select based on value of another select

Hi there,

I’m trying to hide a select field based on the value of another select option. I’ve tried this, but it doesn’t work.

Can anyone tell me what I have wrong?

$("select option[value='option1']").hide("select#secondoption");


Isn’t this rather similar to another recent thread of yours on the very same topic, that seems to have been well covered in quite high detail?
Display element when specific option is selected

The code from your own post #3 shows the following jQuery code:


Also, you might find the actual jQuery API helpful – .hide() doesn’t take a selector as an argument but always hides the element it is called upon.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.