Build a Pokémon Search App Project - Build a Pokémon Search App

Tell us what’s happening:

I passed all the test with this code, but when i want to add text for example on the hp element like this :

document.getElementById(“hp”).textContent = HP: ${data.stats[0].base_stat};

some of the test are not passed again, can someone check?

Your code so far

<!-- file: index.html -->

/* file: script.js */
function updateUI(data) {
    document.getElementById("pokemon-name").textContent = data.name.toUpperCase();
    document.getElementById("pokemon-id").textContent = `#${data.id}`;
    document.getElementById("weight").textContent = `Weight: ${data.weight}`;
    document.getElementById("height").textContent = `Height: ${data.height}`;
    document.getElementById("hp").textContent = `${data.stats[0].base_stat}`;
    document.getElementById("attack").textContent = `${data.stats[1].base_stat}`;
    document.getElementById("defense").textContent = `${data.stats[2].base_stat}`;
    document.getElementById("special-attack").textContent = `${data.stats[3].base_stat}`;
    document.getElementById("special-defense").textContent = `${data.stats[4].base_stat}`;
    document.getElementById("speed").textContent = `${data.stats[5].base_stat}`;

/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36

Challenge Information:

Build a Pokémon Search App Project - Build a Pokémon Search App

if you need help with debugging you need to share all your code

I believe the only data that is allowed to have a label as part of the data, is Weight and Height. For the rest you have to put the “label” outside the element that contains the data.

You could for example add a span element with the label text in front of the element with the data.

test.innerHTML = `<span>Age: </span><span id="someData">42</span>`

do i have to put it inside the function update UI?

If that is the only place where you are updating the DOM, then yes.