Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

331
Vistas
How can i target a search bars input value and store it into a variable to use in an api fetch in javascript for flickr

trying to make a geolocator with a picture search feature associated with the geo location for the user and display on the DOM. want to target the search bars input, store it into a variable, use the variable in my fetch request from a flickr.com API. so the user would type in the search bar, and click the search button and the input from which they type is in the fetch request. declared the variable VALUE. tried to change the variable from the keydown. but wont work in the fetch request. comes up blank and I get an HTTP error.

const searchBar = document.querySelector('#search-Bar')
let value

searchBar.addEventListener('keydown', (e) => {
    
value = e.target.value
    
console.log(value)

})

fetch("https://shrouded-mountain-15003.herokuapp.com/https://flickr.com/services/rest/?api_key=00a31f12afffd2cff1ceeefd8cb8f3bb&format=json&nojsoncallback=1&method=flickr.photos.search&safe_search=1&per_page=5&lat="
        +latitude+"&lon="+longitude+"&text="+value)
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

const searchBar = document.querySelector(“input#search-bar”)

const value = searchBar.value 

or if you want to get the value every time an input value changes

searchBar.addEventListener(“change”, (e) => {
    const value = e.target.value

    /* Whatever you want to do with the value */
})
about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda