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

Tell us what’s happening: can someone tell me what’s wrong in the code it’s not working

Describe your issue in detail here.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>

  </head>
<body><form id="search">
  <input id="search-input" type="text-input" required/>
  <button id="search-button">search</button></form>
   <ol>
     <ul id="pokemon-name">name<ul>  
     <ul id="pokemon-id">id</ul>
     <ul id="weight">weight</ul>
     <ul id="height">height</ul>
     <ul id="types">types</ul>
     <ul id="hp">hp</ul>
     <ul id="attack">attack</ul>
     <ul id="defense">defense</ul>
     <ul id="special-attack">s-attack</ul>
     <ul id="special-defense">s-defense</ul>
     <ul id="speed"></ul>
     

   </tr>
</body>
/* file: styles.css */

/* file: script.js */
const searchinput = document.getElementById("search-input");
const srchBtn = document.getElementById("search-btn")
const name = document.getElementById("pokemon-name")
const id = document.getElementByUd("pokemon-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 specialatk = document.
getElementById("special-attack")
const specialdef = document.
getElementById("special-defense")
const speed = document.
getElementById("speed")

 const allpoki="https://pokeapi-proxy.freecodecamp.rocks/api/pokemon"

let pp = "https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/{name-or-id}"


srchBtn.addEventListener("click",(e)=>{
  e.preventDefault()
  if(searchinput !== allpoki){
    alert("Pokémon not found")
  }
})
showresult.style.display="block"

const searchpoki = ()=>{
  if (searchinput === allpoki){
      let name = name
      name = allpoki.name
      id =  allpoki.id
      hp = allpoki.hp
      attack=allpoki.attack
      defense= allpoki.defense
      specialatk= allpoki.specialatk
      specialdef= allpoki.specialdef
      speed =allpoki.spped
  }
}

Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 17_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Mobile/15E148 Safari/604.1

Challenge Information:

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

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.

Welcome to the forum @h81371417

You need to link the script file in the html page.

Happy coding

1 Like

Thanks ,
I did it and it still not working

Post the update html page so the forum can assist.

Use the following method to post code to the forum:

  1. On a separate line type three back ticks.
  2. On a separate line paste your code.
  3. On the last line type three back ticks. Here is a single back tick `
1 Like

<!DOCTYPE html>
<html lang="en">
  <head>

  </head>
<body><form id="search">
  <input id="search-input" type="text-input" required/>
  <button id="search-button">search</button></form>
   <ol>
     <ul id="pokemon-name">name<ul>  
     <ul id="pokemon-id">id</ul>
     <ul id="weight">weight</ul>
     <ul id="height">height</ul>
     <ul id="types">types</ul>
     <ul id="hp">hp</ul>
     <ul id="attack">attack</ul>
     <ul id="defense">defense</ul>
     <ul id="special-attack">s-attack</ul>
     <ul id="special-defense">s-defense</ul>
     <ul id="speed"></ul>
     

   </tr>
</body>
<script src="./script.js"></script>

You need to have backticks above and below your code

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

put the script before the closing body tag, you are also missing a closing html tag

1 Like

In script file for search button you write wrong Id check that

1 Like