Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
Mostrar el campo de entrada en la opción de selección basada en el botón de clic

este código aún no funciona ... mi requisito es mostrar el campo de entrada en la opción / menú desplegable seleccionado según el botón de clic.

 $(document).on("click", ".btneditsec1_2", function (e) { e.preventDefault(); var _self = $(this); var myacc = _self.data('acc'); var mywacc = _self.data('wacc'); var myitc = _self.data('itc'); $('#id_accreditation').val(myacc); $("#id_w_accreditation").val(mywacc); $("#id_issue_the_certificate").val(myitc); }); $('select[name=accreditation]').on('change', function() { if (this.value == 'Y') { $("#accr").show(); } else { $("#accr").hide(); } });
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script> <br> <div align="right" style="margin-right: 30px;"> <button id="btneditsec1_2" type="button" class="btn btn-warning btn-sm btneditsec1_2" data-acc="Y" data-wacc="Accreditation A" data-itc="Mr. Jones"> <span class="glyphicon glyphicon-tasks"></span> Edit Section 1.2</button> </div> <table> <tr> <td> <label>Has the management / building achieve any accreditation ?</label> <br/> <select name="accreditation" id="id_accreditation" class="form-control" title="Please Select"> <option selected></option> <option value="Y">has achieved</option> <option value="N">hasn't achieved</option> </select> </td> </tr> <tr> <td> <div id="accr" class="form-group" style="display: none;"> <label>What Accreditation :</label> <input type="text" class="form-control input-sm" id="id_w_accreditation" name="w_accreditation"/><br/> <label>Who issue the certificate :</label> <input type="text" class="form-control input-sm" id="id_issue_the_certificate" name="issue_the_certificate" /><br> </div> </td> </tr> </table>

allí, ingrese el texto w_accreditation y emita_el_certificado aún no se muestra cuando hace clic en el botón editar sección 1.2 Ayúdenme, por favor ...

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Supongo que necesita mostrar campos de texto automáticamente según el valor presente en data-acc="Y" . Por favor, corríjame si estoy equivocado. De acuerdo con esto, solo necesita activar el evento de change para su cuadro de select después de establecer su valor de la siguiente manera:

 $(document).on("click", ".btneditsec1_2", function (e) { e.preventDefault(); var _self = $(this); var myacc = _self.data('acc'); var mywacc = _self.data('wacc'); var myitc = _self.data('itc'); $('#id_accreditation').val(myacc).change(); //trigger the change event so that associated event handler will get called $("#id_w_accreditation").val(mywacc); $("#id_issue_the_certificate").val(myitc); }); $('select[name=accreditation]').on('change', function() { if (this.value == 'Y') { $("#accr").show(); } else { $("#accr").hide(); } });
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script> <br> <div align="right" style="margin-right: 30px;"> <button id="btneditsec1_2" type="button" class="btn btn-warning btn-sm btneditsec1_2" data-acc="Y" data-wacc="Accreditation A" data-itc="Mr. Jones"> <span class="glyphicon glyphicon-tasks"></span> Edit Section 1.2</button> </div> <table> <tr> <td> <label>Has the management / building achieve any accreditation ?</label> <br/> <select name="accreditation" id="id_accreditation" class="form-control" title="Please Select"> <option selected></option> <option value="Y">has achieved</option> <option value="N">hasn't achieved</option> </select> </td> </tr> <tr> <td> <div id="accr" class="form-group" style="display: none;"> <label>What Accreditation :</label> <input type="text" class="form-control input-sm" id="id_w_accreditation" name="w_accreditation"/><br/> <label>Who issue the certificate :</label> <input type="text" class="form-control input-sm" id="id_issue_the_certificate" name="issue_the_certificate" /><br> </div> </td> </tr> </table>

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda