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

108
Views
Keep Getting Error "newTask is not defined"

Good afternoon! I keep getting the error "newTask is not defined". I've tried everything but I can't seem to get it working.

const createBtn = document.getElementById("create-btn");

function newTask() {
  let ul = document.getElementsByClassName("task-list");
  let li = document.createElement("li");
  let taskForm = document.getElementById("task-form");
  li.appendChild(document.createTextNode(taskForm.value));
  ul.appendChild(li);
}

createBtn.addEventListener("click", newTask);
<div class="input-wrapper">
          <input
            type="text"
            id="task-form"
            name="task-form"
            placeholder="Type something..."
          />
          <button id="create-btn" onclick="newTask()">
            Create Task
          </button>
        </div>

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!