How to disable the rest of the available checkboxes if some are selected

How to disable the rest of the available checkboxes if some are selected

I was wondering through the internet and I found this type of checkboxes with images. (<a href="https://codepen.io/kskhr/pen/pRwKjg" target="_blank">https://codepen.io/kskhr/pen/pRwKjg</a>) I need to disable the rest of the checkboxes when 3 are selected.

I was wondering through the internet and I found this type of checkboxes with images. (https://codepen.io/kskhr/pen/pRwKjg) I need to disable the rest of the checkboxes when 3 are selected.

JS

// image gallery
// init the state from the input
$(".image-checkbox").each(function () {
  if ($(this).find('input[type="checkbox"]').first().attr("checked")) {
    $(this).addClass('image-checkbox-checked');
  }
  else {
    $(this).removeClass('image-checkbox-checked');
  }
});

// sync the state to the input $(".image-checkbox").on("click", function (e) { $(this).toggleClass('image-checkbox-checked'); var $checkbox = $(this).find('input[type="checkbox"]'); $checkbox.prop("checked",!$checkbox.prop("checked"))

e.preventDefault(); });

I think the best way can be solved with javascript, but i'm a little bit confused.

Thank you!

javascript jquery html5 css3 css

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

Awesome drop down menu on JQuery, HTML5 and CSS3

vegasNavigation .A script for implementing navigation on a site with a normal drop-down list and with mega content. The application is written in JQuery, html5 and ССS3 using the compiler SCSS

HTML5 and CSS3 Fundamentals - Learn HTML5 and CSS3 From Scratch

HTML5 and CSS3 Fundamentals - Learn HTML5 and CSS3 From Scratch, you'll learn the fundamentals of HTML5 & CSS3 programming. Tune in to learn concepts about web pages, CSS3 styles and HTML5 features.

Map Custom Marker and Controls | JavaScript, CSS and API

How we can add a custom marker on google map using JavaScript & CSS? Solution: JavaScript Google Map Marker With CSS, Custom API Map Controls.

How to Check Password Strength with JavaScript, CSS and jQuery

Password is most important way to secure your data.If password is weak in not so strong anybody can access your data it is very important to create a secure password wherever you need. In this post, we will create a Password Strength Checker using JavaScript,jQuery and CSS.

How to Create an autoplay Testimonial Slider with jQuery and CSS

How we can create a testimonial slider using jQuery and CSS? Solution: Responsive Testimonial Slider With jQuery and CSS, an Automated Slider which slides automatically.