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!
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
Elizabeth Mawer
9,554 PointsWhere do I add the JavaScript function to create an Image Gallery?
Fire the plugin Bind the swipebox behaviour on every link with the "swipebox" class.
<script type="text/javascript"> ;( function( $ ) {
$( '.swipebox' ).swipebox();
} )( jQuery ); </script>
I have tried putting the code at the start and end of my HTML but this didn't work. Any help gratefully appreciated!!
2 Answers

Jonathan Grieve
Treehouse Moderator 91,228 PointsThe best place is generally right before the closing body tag in your HTML document. Remember to include the source and type attribute in your script tag.
<script src = "script.js" type="text/javascript"></script>

Melissa Austin
3,383 PointsIn HTML5, the type attribute is no longer required for JavaScript. The default value is "text/javascript".