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

Its telling me that my first span element should be wrapped around the text 0

Describe your issue in detail here.

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">XP:<strong><span id="xpText"> 0</span></strong></span>
<span class="stat">Health: <strong><span id="healthText"> 100</span></strong></span>
<span class="stat">Gold: <strong><span id="goldText"> 50</span></strong></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 (Windows NT 10.0; Win64; x64) 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

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

You seem to have two /span closing tags for each.

Wrap the numbers 0 , 100 , and 50 in span elements, and wrap those new span elements in strong elements. Then give your new span elements id values of xpText , healthText , and goldText , respectively. here are the instructions i got i build it exactly like that

Tried that too it didn’t work any other ideas

The text of your first .stat element should still be XP: 0 . Now it’s telling me that. Reseted the lesson and tried again

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

            <span class="stat">Health: 
               <strong> 
                   <span id="healthText">
                    100
                   </span>
               </strong> 
            </span>

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

            <span class="stat">Health: 
               <strong> 
                   <span id="healthText">
                    100
                   </span>
               </strong> 
            </span>

            <span class="stat" >Gold: 
                <strong> 
                    <span id="goldText">
                      50
                   </span> 
                </strong> 
            </span>```
1 Like

the one i posted in start but i copied and pasted that too but it didn’t work now i don’t know why isn’t its working i think i will start the whole project again

Your text shouldn’t be seperated. Like this: XP: 0 They shouldn’t be in different elements in this step.

1 Like

But the instructions say the numbers should be in another span element than that element should be nested inside a strong element

Sorry, I looked at my answer quickly in step 4. You are right, you need to place them like you said. I’ll take another look at your code now, maybe I see the error you get

1 Like

Could it be there are spaces between your strong-tag en the span-tag? Maybe that causes an error? Otherwise, I can’t seem to find the error either. Your code looks like my solution.

1 Like

Maybe I’ll remove that and than I’ll tell what happened

1 Like

Hey i did that but it didn’t work still giving the same error Your first span element should be wrapped around the text 0 .

You have to put a space after the “:”.

"XP: "

1 Like

Put it all together on one line, so the spacing is more explicit:

<span class="stat">XP: <strong>0

This way it’s clear there is 1 space after XP:, as @deedii mentioned

1 Like

This is working solution:

REDACTED BY MOD

hey @adamkope82
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Hello @sulemankhalil44 , close the space before 0, 100, and 50. I saw that my space is closed and the code passed. Please check.

1 Like

Worked thank you so much guys for helping
happy coding