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

Ari Winokur
PLUS
Ari Winokur
Courses Plus Student 6,844 Points

Using JQuery to make a text field appear and disappear based on Radio Button selection.

I am trying to write a WordPress plugin settings page that has a group of two radio buttons. When one is selected, I want a text field with label hidden, and when the other is selected, I want that text field with label showing. Any thoughts on setting this up with JQuery?

1 Answer

Hi Ari,

I have gotten a pen up and running here, please ignore the styles :).

Let me know if this suits what you are looking for or any tweaks you need made and I will update the pen :)

Craig

Ari Winokur
Ari Winokur
Courses Plus Student 6,844 Points

Thanks! I'll tinker with that concept to see if I can make it work for me. Let me clarify my scenario. Two radio buttons in a group, A and B. When A is selected, that is all. When B is selected a text input field appears. When A is selected again, text field hides.

Hi Ari,

Sorry for the confusion, please take another look at the pen as I have updated it to better suit your needs :)

Craig