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

117
Views
el evento del detector de eventos se está utilizando más de una vez

Tengo este error extraño que cada vez que quiero agregar un elemento/tarjeta a la lista y hago un ciclo entre hacer clic en la entrada de texto y luego hacer clic fuera de él, la lista no agregará solo un elemento sino la cantidad de veces que presioné y fuera.

ingrese la descripción de la imagen aquí

 const main = document.querySelector('main') main.addEventListener('click', (e) => { // Name a group if (e.target.id === 'groupNameInput') { console.log(e.target) let groupNameInput = e.target groupNameInput.addEventListener('change', () => { let groupName = groupNameInput.parentElement console.log(groupNameInput.value) groupNameInput.style.display = 'none' groupName.innerText = `${groupNameInput.value}` groupName.parentElement.lastElementChild.classList.remove('notAssigned') groupName.parentElement.lastElementChild.style.display = 'inline' }) } else if (e.target.classList == 'addCardInput' && e.target.classList != 'notAssigned') { let addCardInput = e.target let taskUl = addCardInput.parentElement.querySelector('.taskUl') addCardInput.addEventListener("keydown", function(event) { if (event.key == 'Enter') { console.log("I'm in!") let newLi = document.createElement('li') newLi.innerHTML = `${event.target.value}` taskUl.appendChild(newLi) } }) } })
 <main> <section class="groupSection"> <span class="groupName"> <input type="text" autocomplete="false" id="groupNameInput" placeholder="name"> </span> <ul class="taskUl"> </ul> <input type="text" class="addCardInput" placeholder="Add a card..."> </section> <section class="addItemsSection"> <button id="addItemsBtn"> <img src="./srcs/add_Icon.png" alt="" id="addItemsImage"> </button> </section> </main>

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!