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

168
Views
Cómo guardar la entrada de una entrada de radio en html/js

Hola, necesito su ayuda para encontrar una manera de guardar mi entrada de radio e imprimirla en la pantalla para saber que está guardada. Tengo este HTML:

 if (document.getElementById('a1').checked) { rate_value1 = document.getElementById('a1').value; document.writeln(rate_value1); } if (document.getElementById('a2').checked) { rate_value2 = document.getElementById('a2').value; document.writeln(rate_value2); } if (document.getElementById('a3').checked) { rate_value3 = document.getElementById('a3').value; document.writeln(rate_value3); } if (document.getElementById('a4').checked) { rate_value4 = document.getElementById('a4').value; document.writeln(rate_value4); } if (document.getElementById('a5').checked) { rate_value5 = document.getElementById('a5').value; document.writeln(rate_value5); }
 <div class='input-form' id="div1"> <h4 id="myText" contenteditable="true">Customize</h4> <input type="radio" name="rating" value="5" id="a5" ><label for="5">5</label> <input type="radio" name="rating" value="4" id="a4" ><label for="4">4</label> <input type="radio" name="rating" value="3" id="a3" ><label for="3">3</label> <input type="radio" name="rating" value="2" id="a2" ><label for="2">2</label> <input type="radio" name="rating" value="1" id="a1" ><label for="1">1</label> </div> <button type='button' id='but_add' value='Add new'>Add Rating Nums</button>

Gracias por tu tiempo

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intente crear otro elemento encima de su <div> y apúntelo cada vez que haga clic en un botón de opción.

 <p id="details"></p> <div> <input type="radio" name="rating" value="5" id="a5" Onclick="display(this.value)" ><label >5</label> </div>

En tu js:

 <script> function display(x){ document.getElementById('details').innerHTML = x; } </script>
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!