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

168
Views
How can i get the value of a created element if its not an input in JS

So I created an item name where i display as the name says the item name and same for item money, and then i have a button that i want to get the values of the item name and item money but it gives me 0

    // Update table
    var expenseTitle = document.createElement("li");
    expenseTitle.innerText = expenseName.value;
    expenseTitle.classList.add("title-item");
    expenseTitle.id = "item-title";
    table.appendChild(expenseTitle);

    var expenseMoney = document.createElement("li");
    expenseMoney.innerText = expenseAmmount.value + "$";
    expenseMoney.classList.add("value-item");
    table.appendChild(expenseMoney);

    var editBtn = document.createElement("button");
    editBtn.innerHTML = "<i class='fas fa-edit'></i>";
    editBtn.classList.add("edit-btn");
    editBtn.onclick = () => {
      // here when i log the expenseTitle value gives me 0
      console.log(expenseTitle.value);
      // same stands for expenseMoney
      console.log(expenseMoney.value);
      expenseTitle.remove();
      expenseMoney.remove();
      editBtn.remove(), deleteBtn.remove();
    };
    table.appendChild(editBtn);
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!