Web programming: JavaScript: avoiding the self-closing script tag
Tutoring web design, this fact is known. The tutor shares some documentation.
I’ve known for some time that the self-closing script tag
<script src=”the_script.js” />
seems not to work. Rather, I use
<script src=”the_script.js”></script>
I’ve wondered why the self-closing script tag doesn’t work; is it just something I’m doing wrong?
Today, I got confirmation that, indeed, the self-closing script tag doesn’t work in html5. Darren Jones, in his book JavaScript: Novice to Ninja (chapter 1) confirms that separate opening and closing script tags must be used.
Source:
Jones, Darren. JavaScript: Novice to Ninja. SitePoint Pty. Ltd., 2014.
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.
Leave a Reply
You must be logged in to post a comment.