Learn Basic JavaScript by Building a Role Playing Game - Step 18

I did the changes as requested. The “Check your code” button doesn’t work…period. Nothing happens when clicked.

Console errors seen after clicking the button:
/page-data/fcc8e26fe3c-f1d1-4023-b8d2-ecedafc4b397/page-data.json:1

   Failed to load resource: the server responded with a status of 404 ()

/fcc8e26fe3c-f1d1-4023-b8d2-ecedafc4b397:1

   Failed to load resource: the server responded with a status of 404 ()

Please post your code and a link to the Step. Thanks

Code:

  <script src="./script.js" />

It looks like you’re missing a closing script tag

No I am not. Remember basic xml? “/>” is the closing of the tag and valid html.

No, /> can only be applied on self closing tags. A script tag is not a self closing tag.

2 Likes

Crazy, I have been doing that for over 20 years, first time having a problem with that. Would be good to have a message about that on a submit attempt.

MDN doesn’t list that as a valid way to use the script tag: <script>: The Script element - HTML: HyperText Markup Language | MDN

Also, MDN does not list the script element as a valid void element: Void element - MDN Web Docs Glossary: Definitions of Web-related terms | MDN

If a trailing / (slash) character is present in the start tag of an HTML element, HTML parsers ignore that slash character. This is important to remember when an element such as <script> or <ul> does require a closing tag. In this case, adding a trailing slash in the start tag does not close the element.

3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.