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

201
Views
Valor del botón de opción para la expresión de la declaración de cambio

Tengo dos declaraciones de cambio y necesito una tercera declaración para determinar una de las dos para ejecutar. En la primera declaración (predeterminada) tengo:

 innerHTML = "<form><input id='rb1' type='radio' name='option1' value='1'>1<input type='radio' name='option1' value='2'>2<form>";

Estoy tratando de colocar el valor en var testNumber

He usado document.getelementByNames('option1').checked y, por alguna razón, checked provoca errores. iv también usó document.querySelector('input[name="rate"]:checked').value; y eso tambien genera errores

 function switch (testNumber) { case 1: test1(); break; case 2: test2(); break; default: test1(); break; } function test1() { let div1 = document.getElementById('div1'); div1.innerHTML = "<form><input id='rb1' type='radio' name='option1' value='1'>1<input type='radio' name='option1' value='2'>2<form>"; testNumber = whatTest(); } whatTest() { let option1 = document.getElementsByName(option1) for (let i = 0; i < option1.length; i++) { if (option1[i].checked) { return option1[i].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!