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

231
Vistas
Radio Input onchange display label innerText in textbox
 <div class="top">
      <label for="locationName">Location:</label>
      <input type="text" class="locationName" id="locationName" maxlength="20" readonly>
 </div>
 <li>
      <input type="radio" id="selected_location_ac" name="selected_location" value="ATLANTIC_CITY" onchange="findSelection('selected_location')">
      <label for="selected_location_ac">Atlantic City</label>
 </li>
 <li>
      <input type="radio" id="selected_location_ac" name="selected_location" value="LAS_VEGAS" onchange="findSelection('selected_location')">
      <label for="selected_location_ac">LAS Vegas</label>
 </li>

JavaScript

function findSelection(rad_name) {
    const locationName = document.querySelector("#locationName");
    let rad_val = document.querySelector('input[name=' + rad_name + ']:checked');
    locationName.value = (rad_val ? rad_val.value : "")
    return (rad_val ? rad_val.value : "");
}

I am trying to get the label value displayed in the input text box.

The person will click a radio button and then the input textbox will display their selection. I don't want it to show the radio button value since it maybe difficult to understand what it means.

about 4 years ago · Juan Pablo Isaza
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