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
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 answers
Answer question

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 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!