Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

datajournalismguy
3,274 Points<script> and <noscript> tags and unobtrusive JavaScript
Hi there,
can't you just use <script> and <noscript> tags to control what users see with disabled JavaScript instead of adding HTML with the jQuery .append() method?
Thanks!
2 Answers

Steven Parker
221,902 PointsIt's not an "instead" situation — you would typically use these things together.
Anything written in jQuery will only run if scripting is enabled, and you might combine this with code inside a <noscript>
tag to display something else when it is not enabled.

datajournalismguy
3,274 PointsThanks! But why can't you just put HTML within a <script> tag? Wouldn't that be easier than inserting HTML with JavaScript/jQuery?

Steven Parker
221,902 PointsI see what you mean, but I guess the creators of HTML probably expected that if you use scripting at all, you probably want to add a some functionality in addition to just displaying some HTML elements, so they left it up to the script code to do that. Not all scripts add anything to the HTML at all.