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
Anthony Eriksen
Front End Web Development Techdegree Graduate 16,099 PointsButton works but text isn't showing?
After deleting the button in the HTML and adding it through jQuery, the button displays and works but the text "Reveal Spoiler" isn't showing on the button. My code looks identical, not sure what the difference is.
3 Answers
Anthony Eriksen
Front End Web Development Techdegree Graduate 16,099 PointsNevermind, found the answer from the syntax highlighting in the forum. Was missing a > at the end of the button closing tag!
Jason Pallone
11,340 PointsHey Anthony I'd love to help, but could you share the code with us or a snapshot of your workspace? It's hard to help without actually seeing the code. Thanks and feel free to respond to me once you upload the code or if you have questions about how!
Anthony Eriksen
Front End Web Development Techdegree Graduate 16,099 Points//Create the "Reveal Spoiler" button
const $button = $('<button>Reveal Spoiler</button');
//Append to web page
$('.spoiler').append($button);
// the spoiler text
$('.spoiler span').hide();
//When button is pressed
$('.spoiler button').click(function(){
//Show spoiler text
$('.spoiler span').show();
//Hide the "Reveal Spoiler" button
$('.spoiler button').hide();
});
Woops, sorry about that haha.
Steven Parker
243,266 PointsSteven Parker
243,266 PointsIf you make a snapshot of your workspace and post the link to it here we can replicate the issue, and I'll bet help you find it.