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

321
Views
Entrada con type="radio". Y abarque dónde necesito obtener un resultado con solo hacer clic en "sí"

Estoy aprendiendo JS. Creé una entrada con type="radio". Y hay un lapso en el que necesito obtener un resultado con solo hacer clic en "sí". ¿Qué está mal? ¿Por qué no funciona? ¿Podría alguien ayudarme por favor?

 <h2>Do you need transportation?</h2> <div class="transport"> <input class="radio" id="yesTransport" name="t" type="radio"> <label for="yesTransport">Yes</label> <input class="radio" id="noTransport" name="t" type="radio" checked> <label for="noTransport">No</label> </div> <button id="calculate">РАССЧИТАТЬ</button> <div id="transportation"> <span class="forWhat">За трансфер</span> <span>₽ <span id="transportationTotal"></span> </span> </div>

código:

 const transpYes = document.querySelector("#yesTransport"); transpYes.addEventListener("change", transpNeeded); function transpNeeded() { let amountUpTo3 = 50; let amountUpTo5 = 100; if (people == 1 || people <= 3) { document.querySelector("#transportationTotal").textContent = amountUpTo3.toFixed(2); } else if (people > 3 || people <= 5) { document.querySelector("#transportationTotal").textContent = amountUpTo5.toFixed(2); }

También hay personas constantes en otra parte del código:

 const people = document.querySelector("#people").value;
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!