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

167
Views
¿Puede alguien ayudarme por qué esta constante está devolviendo nulo?

el mensaje de error que me sigue apareciendo Uncaught TypeError: form.querySelector(...) is null todo funcionaba bien hasta hace un tiempo, así que debo haber cambiado algo que no sé sobre file:///C:/Users/Ben /Documentos/descargar archivo de texto/v12/prueba v12 .html:35

 <html> <form name="addtext"> <table> <tr> <tr> <th> Fan Delay </th> <th><input id="fanDelay" type="text" name="fanDelay" value="0" /></th> </tr> </table> <table class="center"> <th></th> <th> <input type="submit" name="name" value="Save File" placeholder="File Name" /> </th> </table> </form> </html> <script> /* Run script after DOMContentLoaded event to ensure form element is present */ document.addEventListener("DOMContentLoaded", function() { /* Obtain form element via querySelector */ const form = document.querySelector('form[name="addtext"]'); /* Bind listener to forms submit event */ form.addEventListener("submit", function(event) { /* Prevent browsers default submit and page-reload behavior */ event.preventDefault(); var fanDelay = form.querySelector('select[name="fanDelay"]').value; // const text = `TACm Settings VER PRO dt: ${fanDelay} `; /* Create temporary link element and trigger file download */ const link = document.createElement("a"); const href = "data:text/plain;charset=utf-8," + encodeURIComponent(text); link.setAttribute("href", href); link.setAttribute("download", "usb.txt"); document.body.appendChild(link); link.click(); document.body.removeChild(link); }); }); </script>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Creo que el error viene de aquí form.querySelector('select[name="fanDelay"]').value

Está utilizando la etiqueta <input> , así que simplemente cámbiela a form.querySelector('input[name="fanDelay"]').value

about 4 years ago · Juan Pablo Isaza Report

0

usted está tratando de queryselector una select en lugar de input

prueba esto :

 var fanDelay = form.querySelector('input[name="fanDelay"]').value;
about 4 years ago · Juan Pablo Isaza Report
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!