Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!