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

108
Visualizações
Detect checkbox click/change event in Chrome 93 for desktop

This code:

<div class="form-check form-switch">
    <input class="form-check-input" type="checkbox" role="switch" id="switchService">
    <label class="form-check-label" for="switchService">Service</label>
</div>

$("#switchService").on('click', function() {
    alert($(this).is(':checked'));
});

works in Firefox and in Chrome for Android. But in Firefox 93 for Desktop (Windows 7) does not trigger the event.

I also tried a lot of different syntaxes like:

$("#switchService").on('click', function() {
$("#switchService").on('change', function() {
$("#switchService").change(function() {

All of the above works in all browsers I tried but the Chrome 93 for desktop.

Is there a specific syntax for it? Of course javascript is enabled, as other scripts work fine.

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

0

You can avoid the "race-condition"-type difficulties mentioned by @RoryMcCrossan if you use event delegation like shown here:

$("body").on("click","#switchService",  function() { ... })
         .on("change","#switchService", function() { ... })
         .on("change","#switchService", function() { ... });
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