I am trying to achieve the following with jQuery:
Select max 3 check boxes out of 20, w开发者_JAVA技巧hen three check boxes are selected run jQuery function.
If I understand correctly you want to run a function if three boxes are checked? To do that use
$(":checkbox").click(function(){
if($(":checkbox:checked").length==3))
  //run function here
});
I'm considering the example on the official documentation of Jquery: http://api.jquery.com/checked-selector/
<script>
    function myFunction(){
    }
    function countChecked() {
      var n = $("input:checked").length;
      if(n==3){
         myFunction();
      }
    }
    $(":checkbox").click(countChecked);
</script>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论