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

166
Views
¿Por qué el autocompletado de VS Code no sugiere el atributo .value cuando se trabaja con un archivo Java Script?

HTML:

 <body> <h1>Grocery List</h1> <form action="/nowhere"> <label for="item">Enter A Product</label> <input type="text" id="product" name="product" /> <label for="item">Enter A Quantity</label> <input type="number" id="qty" name="qty" /> <button>Submit</button> </form> <ul id="list"></ul> </body>

Escritura de Java:

 const frm = document.querySelector("form"); const prdct = document.querySelector("#product"); const qty = document.querySelector("#qty"); const mylst = document.querySelector("#list"); frm.addEventListener("submit", (e) => { e.preventDefault(); const myele = document.createElement("li"); myele.textContent = qty.value; myele.textContent += ` ${prdct.value}`; mylst.appendChild(myele); qty.value = ""; prdct.value = ""; });

Como puede verse, el código VS no sugiere el atributo '.value' con otras sugerencias. cual puede ser la razon?

El código VS no sugiere el atributo .value

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Document.querySelector() devuelve un Element , por lo que el editor no puede saber que tiene un value .

Si creara el elemento por javascript, entonces el editor SÍ sabe...

 let input = document.createElement("input") let test = input.value // now you can get autocomplete

Otra forma es usar mecanografiado:

 let input:HTMLInputElement = document.querySelector("myinput")! let test = input.value // now you can get autocomplete
about 4 years ago · Santiago Gelvez 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!