Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
Dynamically rendering objects from API in Javascript(object/API/dynamic rendering)

I have an array and objects in it, brought with the help of API. And If I enter name of an object to input it have to find that object and render its other properties to specific tags of HTML which are located in the same container with my input I entered name. Actually this should have done in Javascript.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

First, in order to find an object by its name, you can use arr.filter():

var desiredName = "Name 1" //The name entered into the input
const objects = [{name: "Name 1", name: "Name 2"}] //Your array of objects

//Use arr.filter() to find the item with the desired name
var selectedObject = objects.filter((item) => {
  return item.name = desiredName
})[0] //Target the first element in the returned array

As far as populating paragraph elements with the selected objects properties, you can just use document.getEleemntById():

document.getElementById("someElement").innerHTML = "Your Text"
<p id="someElement"></p>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda