revsj
February 9, 2024, 4:40am
1
I can’t figure out how to keep the XP:0 but wrapped around with the span element, can someone help me?
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./styles.css">
<title>RPG - Dragon Repeller</title>
<script src="./script.js"></script>
</head>
<body>
<div id="game">
<div id="stats">
<!-- User Editable Region -->
<span class="stat"><strong>XP:<span id="xpText">0</span></strong>
<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>
/* file: script.js */
let xp = 0;
let health = 100;
let gold = 50;
let currentWeapon = 0;
let fighting;
let monsterHealth;
let inventory = ["stick"];
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 17
Hello. Welcome to our forum.
The instructions should be applied to the three lines of code, not the first line alone.
revsj
February 9, 2024, 5:07am
3
i already applied everything but still my problem is how can i keep it as XP: 0 but still wrapped around the span element
<span class="stat"><strong>XP:<span id="xpText">0</span></strong>
<span class="stat"><strong>Health: <span id="healthText">100</span></strong>
Check your strong element, it should nest the correct code, which is this code <span id="xpText">0</span>
.You also lack a closing span tag in your code. You should be careful with this line of instructions
wrap those new span elements in strong elements.
Just take your time and structure the code precisely.
revsj
February 9, 2024, 5:31am
5
it says this “The text of your first .stat
element should still be XP: 0
”
type or paste cod<span class="stat">XP:<strong><span id="xpText">0</span></strong>
<span class="stat">Health:<strong><span id="healthText">100</span></strong>
<span class="stat">Gold: <strong><span id="goldText">50</span></strong>e here
Ray13
February 9, 2024, 5:35am
6
Hi! It should be a one space here:
XP: <
Health: <
Just like your
Gold: <
1 Like
Let me structure a pattern that will guide you through.
<span class="name">TEXT: <strong><span id="value">Number</span></strong></span>
Now check which element is wrongly placed in your code and make the adjustments.
1 Like
revsj
February 9, 2024, 5:39am
8
thank u i got it!<33 i just missed a closing span tag in the end
great information like it
system
Closed
August 9, 2024, 6:02pm
10
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.