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

117
Visualizações
Checkbox on change event is not working on Safari

Thanks in advance for the help on this. I have a special requirement on my page where I needed a checkbox to "act" like a radio button, so only one can be checked at a time. To achieve that I used this snippet below"

<script>
$('input:checkbox').on('change', function() {
  $('input:checked').not($(this)).closest('.w-checkbox').click();
});
</script>

It works perfectly on Chrome. However, it doesn't work on Safari and allows more than one checkbox to be clicked. I was wondering if anyone had ideas on how to solve this because I have tried many alternatives and unfortunately need to have the checkbox

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The proper way to uncheck a checkbox is by changing the checked property.

$('input:checkbox.w-checkbox').change(function() {
  $('input:checkbox.w-checkbox').not(this).prop('checked', false);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<input type="checkbox" class="w-checkbox" />
<input type="checkbox" class="w-checkbox" />
<input type="checkbox" class="w-checkbox" />

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