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

165
Views
Cambié textContent de mi elemento span y parece haber cambiado en console.log pero no cambia en la pantalla

Esta es la función en la que agrego un nuevo elemento a mi lista de tareas pendientes y agrego un intervalo llamado "eliminar" al final de mi elemento como un botón.

 function newElement() { count++; var li = document.createElement("li"); var inputValue = document.getElementById("addNewItem").value; var t = document.createElement("Label"); var checkB=document.createElement("input"); checkB.setAttribute("type","checkbox"); checkB.setAttribute("id",count); t.setAttribute("for",count); t.textContent=inputValue; t.appendChild(checkB); li.appendChild(t); if (inputValue === '') { alert("You cannot add an empty element!"); } else { document.getElementById("myList").appendChild(li); } document.getElementById("addNewItem").value = ""; <!--adding delete button to each new item--> var span = document.createElement("SPAN"); span.className = "close"; span.textContent="delete"; console.log(span.textContent); li.appendChild(span); }

Aquí traté de cambiar el texto de lapso a "cancelar". Cuando lo reviso por console.log(span.textContent) el texto parece cambiado como cancelar pero en la pantalla todavía veo el lapso como eliminar

 var list = document.querySelector('ul'); list.addEventListener('click', function(e) { if (e.target.tagName === 'LABEL') { var li=e.target.parentElement; var label=e.target; label.style.textDecoration="line-through"; var span=li.getElementsByTagName("span"); span.textContent="cancel"; completedTaskHolder.appendChild(li); }

todavía está borrado

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!