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

Tell us what’s happening:

I get the error: Your first span element should be wrapped around the text 0 .

Is what I have below not doing that? This approach to learning is quite confusing.

Your code so far

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./styles.css">
    <title>RPG - Dragon Repeller</title>
</head>
<body>
    <div id="game">
        <div id="stats">

<!-- User Editable Region -->

            <span class="stat">
                <strong>XP:
                    <span id="xpText">
                        0
                    </span>
                </strong>
            </span>
            <span class="stat">Health: 100</span>
            <span class="stat">Gold: 50</span>

<!-- User Editable Region -->

        </div>
        <div id="controls"></div>
        <div id="monsterStats"></div>
        <div id="text"></div>
    </div>
</body>
</html>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

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

1 Like

do not go to new line

Thanks for the quick reply.

Making it this: (all on one line)
<span class="stat">XP: 0<strong><span id="xpText">0</span></strong></span>

Gives error:

The text of your first .stat element should still be XP: 0 .

My original passed the w3 HTML validation so I don’t understand how multiple lines can be the issue.

Between the instructions and the in-browser editor ‘del’ and ‘backspace’ keys having bizarre functionality as they don’t behave like VSCODE usage, it took longer than normal…

This works: (one line)

<span class="stat">XP: <strong><span id="xpText">0</span></strong></span>

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