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 jQuery Basics (2014) Creating a Spoiler Revealer Perform: Part 1

James Cocker
James Cocker
3,429 Points

Add the button markup directly in the HTML?

Rather than using jQuery to insert the button markup, is there anything wrong with just adding it to the HTML file, and then using jQuery to hide/show it as required?

My thoughts are that the HTML is then all in one place, rather than putting HTML in the .js file.

2 Answers

Button markup as in what exactly?

James Barnett
James Barnett
39,199 Points

If you look to right under the big green "start discussion" button is "related content". Check out the video linked there.

James Cocker
James Cocker
3,429 Points

See the related video. <button>Reveal the spoiler!</button>