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

102
Visualizações
Trigger the function of checked boxes to one button js

I wanted to if I could do this with only using javascript. I have a pdf links on each of my checkboxes. So if the selected checkboxes are checked then it would go to that links but only when the button is clicked.

$(function() {
  $("input[name='check[]']").bind("myCustomButtonClick", function() {
    var item = $(this);
    if (item.is(":checked")) {
      item.siblings('a.dev-link').trigger('click');
    }
  });
})

$(document).on('click', '#dl-link', function() {
  $("input[name='check[]']").trigger("myCustomButtonClick");
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<label id="link" class="w-checkbox dl-check-wrap">
  <div class="w-checkbox-input w-checkbox-input--inputType-custom dl-check dev-check w--redirected-checked"></div>
  <input type="checkbox" name="check[]" data-name="check[]" id="mode">
  <a href="https://drive.google.com/uc?export=download&amp;id=17XNOXQ3dKZM9tznx4xGk8I0O5hcvw0kc" class="dl-link dev-link">Link</a>
  <span class="d-none w-form-label" for="check[]">Checkbox 4</span>
</label>

<a id="dl-link" href="#" class="dl-btn w-button">Download All</a>

about 4 years ago · Juan Pablo Isaza
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