Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

254
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda