Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
¿Cómo establecer un valor en un modal de arranque y luego pasarlo en un cuadro de texto deshabilitado?

Me gustaría establecer un valor a través de un formulario en un modal y que ese valor se refleje en un cuadro de texto deshabilitado en la pantalla principal. ¿Cuáles son las mejores opciones que hay?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puede funcionar usando jQuery con la ayuda del controlador de eventos

Maneje el evento de clic del cuadro de diálogo modal, pase datos seleccionando #Id en modal y muéstrelo

Algo como.,

 $(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 Report

0

Suponiendo que esto es bootstrap5:

Parece que solo debe obtener el valor después de que se cierre el modal ... que es lo que hace la función adjunta a myModalEl.addEventListener .

event.target devuelve el elemento que tiene el detector de eventos adjunto, pero como dije en los comentarios en el código a continuación, si no es así, entonces hay un millón de formas diferentes de hacerlo.

 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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!