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

HTML

"Payment Info" section, Any hints, suggestions and comments are welcome thank you in advance for your help!!!

The preferred or most common payment method option should be selected and the corresponding payment form sections should be displayed by default, while the other payment form sections should be hidden.

Programming the "Payment Info" section requires working with the following elements:

The "I'm going to pay with:" <select> element The <div> element with the id of "credit-card" The <div> element with the id of "paypal" The <div> element with the id of "bitcoin" Create variables to reference the above elements, and log them out to the console to confirm their identity. Use the "paypal" and "bitcoin" variables above to hide these elements initially. Use the payment variable above to target the element’s second child element and give it the selected property. The .children property and the setAttribute method will be helpful here. Use the payment variable above to listen for the change event on this element. When a change is detected, display the <div> element with the id that matches the value of the event.target element. And hide the other two <div> elements. Now save and refresh the page, and when the payment method option is updated in the drop-down menu, the payment sections in the form will update accordingly.