Tell us what’s happening:
i didnt meet the step 20 . i tried all the way that was possible, please help
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>RPG Creature Search App</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<main>
<h1>Creature Search</h1>
<div>
<input type="text" id="search-input" required />
<button id="search-button">Search</button>
</div>
<section id="creature-info">
<h2 id="creature-name"></h2>
<p id="creature-id"></p>
<p id="weight"></p>
<p id="height"></p>
<div id="types"></div>
<ul>
<li>HP: <span id="hp"></span></li>
<li>Attack: <span id="attack"></span></li>
<li>Defense: <span id="defense"></span></li>
<li>Special Attack: <span id="special-attack"></span></li>
<li>Special Defense: <span id="special-defense"></span></li>
<li>Speed: <span id="speed"></span></li>
</ul>
</section>
</main>
<script type="module" src="script.js"></script>
</body>
</html>
/* file: styles.css */
/* file: script.js */
document.getElementById("search-button").addEventListener("click", () => {
const searchInput = document.getElementById('search-input').value.trim().toLowerCase();
const creatureName = document.getElementById('creature-name');
const creatureId = document.getElementById('creature-id');
const weight = document.getElementById('weight');
const height = document.getElementById('height');
const types = document.getElementById('types');
const hp = document.getElementById('hp');
const attack = document.getElementById('attack');
const defense = document.getElementById('defense');
const specialAttack = document.getElementById('special-attack');
const specialDefense = document.getElementById('special-defense');
const speed = document.getElementById('speed');
// Clear previous results
creatureName.textContent = '';
creatureId.textContent = '';
weight.textContent = '';
height.textContent = '';
types.innerHTML = '';
hp.textContent = '';
attack.textContent = '';
defense.textContent = '';
specialAttack.textContent = '';
specialDefense.textContent = '';
speed.textContent = '';
// Normalize for comparison
const normalizedInput = searchInput.toLowerCase();
if (!normalizedInput) return;
if (normalizedInput === "red") {
alert("Creature not found");
} else if (normalizedInput === "pyrolynx" || normalizedInput === "1") {
creatureName.textContent = 'PYROLYNX';
creatureId.textContent = 1;
weight.textContent = 42;
height.textContent = 32;
hp.textContent = 65;
attack.textContent = 80;
defense.textContent = 50;
specialAttack.textContent = 90;
specialDefense.textContent = 55;
speed.textContent = 100;
types.innerHTML = '<p>FIRE</p>';
} else if (normalizedInput === "aquoroc" || normalizedInput === "2") {
creatureName.textContent = 'AQUOROC';
creatureId.textContent = 2;
weight.textContent = 220;
height.textContent = 53;
hp.textContent = 85;
attack.textContent = 90;
defense.textContent = 120;
specialAttack.textContent = 60;
specialDefense.textContent = 70;
speed.textContent = 40;
types.innerHTML = '<p>WATER</p><p>ROCK</p>';
} else {
alert('Creature not found');
}
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Creature Search App Project - Build an RPG Creature Search App