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

113
Vistas
How to set a value in a bootstrap modal and then pass it in a disabled textbox?

I would like to set a value via a form in a modal and have that value reflected on a disabled textbox in the main screen. What are the best options out there?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

It can make work using jQuery with the help of event handler

Handle click event of modal dialog, pass data by selecting #Id into modal and show it

Something like.,

$(document).on("click", ".open-modalDialog", function () {
     var mytxtInput1Id = $(this).data('txtInput1');
     $(".modal-body #txtInput1").val( mytxtInput1Id );
     //you have call modal to open here
     $('#addModalDialog').modal('show');
});
about 4 years ago · Juan Pablo Isaza Denunciar

0

Assuming this is bootstrap5:

It seems like you should only get the value after the modal closes... which is what the function attached to myModalEl.addEventListener does.

event.target typical returns the element that has the event listener attached to it, but like I said in the comments in the code below, if it doesn't, then there are a million and one different ways to do so.

var myModalEl = document.getElementById('myModal');
myModalEl.addEventListener('hide.bs.modal', function (event) {
  // getElementsByName returns a list of elements, so be sure to select an element to perform on
  document.getElementsByName("name_of_hidden_element")[0].value = event.target.getElementsByName("name_of_element_inside_of_modal")[0].value
  //event.target.... should work to get the element from inside the modal, but if it doesn't there are several other ways to do so.
});
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