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

252
Views
Cambiar el valor de un TEXTO DE ENTRADA marcando una casilla de verificación

¿Por qué esto no funciona? Se supone que funciona de esta manera: si la casilla de verificación está marcada, debe tomar el contenido de una variable txt y escribirlo en la entrada con la identificación de show.

 function myFunction() { if (document.getElementById('myRadio').checked) { var txt = "Done"; document.getElementById("show").innerHTML = 'txt'; } }
 <p>If the radio checkbox is checked the text from the variable text is written into input line with the ID of show</p> <input type="checkbox" onclick="myFunction()" id="myRadio"> <br> <br> <input type="text" class="form-control" id="show">

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

0

Debe establecer la propiedad de value del elemento de entrada, no el innerHTML :

 function myFunction() { if (document.getElementById('myRadio').checked){ var txt = "Done"; document.getElementById("show").value = txt; } else { document.getElementById("show").value = ''; } }
 <p>If the radio checkbox is checked the text from the variable text is written into input line with the ID of show</p> <input type="checkbox" onclick="myFunction()" id="myRadio"> <br> <br> <input type="text" class="form-control" id="show">

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!