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

65
Vistas
How to set the value of select field to an input field

I am having a bit of problem here. I have have two fields one is a select field and the other is an input field which is readonly. What i am doing is that i am getting the value of the select and setting its value to the input field. Now here is the case where i want to save the "name" at the select field instead of the "232" but because i am setting its value to the input field whenever i change the "232" at the select to "name" the input fields value also changes to "name". How can i set the value of the select to name without changing the value of the input field which is "232"

                                        <label for="position-bottom-left"> Instruments <span class="mandatory">*</span></label>
                                        <select class="select2 form-select shadow-none" name="instrutype" id="instrutype" class="form-control demo" data-control="hue">
                                            <option selected="true" disabled="disabled">Select Intrument </option>
                                            
                                                    <option value="<?php echo "232"; ?>"> <?php echo "name"; ?></option>
                                        </select>

                                    </div>

                                    <div class="col-md-6 fieldspaceout">
                                        <label for="hue-demo">Tenure<span class="mandatory">*</span></label>
                                        <input type="text" name="tenure" id="tenure" class="form-control demo" data-control="hue" data-position="bottom left" value="<?php echo $tenure; ?>" readonly>
                                    </div>

<script type="text/javascript">
    var select = document.getElementById('instrutype');
    var input = document.getElementById('tenure');
    select.onchange = function() {
        input.value = select.value;
    }
</script>
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