0

I have this code which executes when text is pasted into an input field. It works perfectly when I have the alert included (ie makeCode() is excecuted), but when I comment out the alert then makeCode() is no longer executed. Thoughts?

const handleInputPaste = ev => {
    //alert("hi");
    makeCode();
}

inputs.forEach(input => {
    input.addEventListener('paste', handleInputPaste)
})
Brad
  • 1,019
  • 1
  • 9
  • 22
  • 3
    Please show more code. Sounds like a timing issue. Click edit, then `[<>]` snippet editor and provide a [mcve]. Also consider delegation to the nearest static container and perhaps use `input` event instead – mplungjan Sep 08 '20 at 10:38
  • 1
    I may be talking nonsense, but I believe that alert ends up giving you time to load some important information for `makeCode()` – Aks Jacoves Sep 08 '20 at 10:39

0 Answers0