Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Customizer API Custom WordPress Customizer Settings An Overview of Custom Controls in WordPress

Ulises Calvo
Ulises Calvo
2,233 Points

How to hide a Custom Control?

I know contextual controls hide if for example the user navigates from the viewer certain pages.

But how can I achieve hiding a control under this scenario:

There is a type Select Control with an array of options from 1 to 6, Default being 1.

Then there are 6 type Text controls underneath. I want those controls (except for the first one) to be hidden on load and shown depending on what the user chooses from the Select control.

In other words the Select control determines the number of Text controllers the user would see.

I tried some JQuery which I am not very good at and the #customize-control_dadada... id's just would not obey.

I can't find any info on this matter, all I find is information about the contextual controls which are useful but do not seem what I need for this matter.

Any ideas? thank you in advance.