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

213
Views
how to remove an object from an array?

I created a dynamic objects array. and I want to remove object value from the array that's entered by the user. how to target each key and value indiviually please any help

//get user iput in name field
var inputName = document.getElementById("name");
//get user iput in price field
var inputPrice = document.getElementById("price");
//get user iput in desc field
var inputDesc = document.getElementById("desc");
//form submition
var formSubmit = document.querySelector("form");
//get ul
var ul = document.getElementById("list");
//empty array to add inputted user data
var products = [];
//delete button
var button = document.querySelectorAll(".btn");


//eventlistener on the form
formSubmit.addEventListener("submit", addProduct);

//form eventlistener function
function addProduct(e) {
    //to stop default form functions
    e.preventDefault();
    //create users input object
    var item = {
        title: inputName.value,
        desc: inputDesc.value,
        price: inputPrice.value
    } 
//add users input to products array
products.push(item);
ul.innerHTML = "";
console.log(products);
//loop over users input array
//add li items to the ul from users input
for (var i = 0; i < products.length; i++) {
    ul.innerHTML += "<li>" + products[i].title + products[i].desc + products[i].price + "</li>";
} 
}

about 4 years ago · Juan Pablo Isaza
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!