0

I want to perform a certain function using Javascript after 2000ms

document.querySelector('[name="4109~~0~0~0~18291930$txtValue"]').value = 'APPLE';

For this I have set the code as:

function fireTheSubmitEvent() {
 setTimeout(fireTheSubmitEvent, 2000)
 
  document.querySelector('[name="4109~~0~0~0~18291930$txtValue"]').value = 'APPLE';
  }

But it is not firing. Where am I going wrong?. Please guide.

athma 2022
  • 45
  • 2
  • Put the `setTimeout` *outside* the function, or it'll never be called – CertainPerformance Oct 15 '22 at 05:09
  • Thanks , This solved my querry. Corrected code is ```function fireTheSubmitEvent() { document.querySelector('[name="4109~~0~0~0~18291930$txtValue"]').value = 'APPLE'; }``` setTimeout(fireTheSubmitEvent, 2000) – athma 2022 Oct 15 '22 at 05:20

0 Answers0