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
Why isn't Dave putting his <script> tags at the end of the body?
We have been taught to put <scipt> tags at the end of our body tags, am i missing something?
Jason AndersTreehouse Moderator 145,857 Points
While it is often Best Practice to include the JS script files at the end of the HTML, there are many times where this might actually break the site instead.
I hope that helps clear it up.
James ChurchillTreehouse Teacher
Knowing where to put
<script> tags can be a bit tricky. One of the advantages of putting
<script> tags just before the closing
<body> tag, is that you know you can safely access other elements on the page, without having to write any extra code.
Unfortunately, there are downsides to this approach. For a detailed overview of the various options that exist (including the new
<script> tag attributes), check out this community post: