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

231
Views
¿Por qué no se agrega la entrada a la lista?

Estoy tratando de hacer una lista de tareas simple, anteriormente lo hice funcionar, pero ahora que intenté agregar una función que verificó si la entrada está vacía, ya no funciona, hacer clic en el botón Agregar no hace nada.

Mi código :

 function addLi() { var li = document.createElement("li"); var input = document.getElementById("TaskText").value; var txtNode = document.createTextNode(input); li.appendChild(txtNode); if (input === '') { alert("Must write a task!"); } else { document.getElementById("list");appendChild(li) } document.getElementById("TaskText").value = ""; }
 <body> <h1>Your To-Do List</h1> <label>Add a task to your list</label> <br> <input type="text" placeholder="Add task..." id="TaskText"> <button onclick="addLi()" id="AddTask">Add</button> <ul id="list"> <li>This is an example of a task!</li> </ul> </body>

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!