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

263
Vistas
How to access the value of input id javascript?

I have this:

<script>
  $(function() {
    $('#clientStatus').on('show.bs.modal', function(event) {
      var button = $(event.relatedTarget); // Button that triggered the modal
      var theclientCurrentStatus = button.data('clientcurrentstatus'); // Extract info from data-* attributes
      var clientusername = button.data('clientusername');
      // $("#radio_1").prop("checked", true); 
      // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
      // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
      var modal = $(this);
      modal.find('#clientcurrentstatus').val(theclientCurrentStatus);
      modal.find('#clientusername').val(clientusername);
    });
  });    
</script>

It passes the data values to the bootstrap modal. However, what it actually do is that it sets the value of the data I am passing to the id of the input in the modal:

<input type="text" id="clientcurrentstatus" readonly>

When I output this to screen, it shows the value of clientcurrentstatus which in this case is active. However, when I try to access the value of the id, it doesn't work and instead show me this:

console.log(document.getElementById('clientcurrentstatus').value)

How can I access this value of the id?

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