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

JavaScript jQuery Basics (2014) Creating a Simple Lightbox Perform: Part 3

Isaac Minogue
Isaac Minogue
3,543 Points

<img> tag

So, I get that we're adding an <img> tag to $overlay, to hold the href. But no where did we close the tag! Is this standard practice with jQuery syntax? Like does the DOM just automatically add a closing tag when it can't find one? If this was html, it would spit out an error wouldn't it? but it works perfectly fine here. Any pros got an answer for me? :)

1 Answer

Hi Issac,

Actually,

<img>

tag is self closing. XHTML could be

<img...... />

but this is not necessary with HTML.