Checking all checkboxes in classic asp

Bob Schneider
Bob Schneider used Ask the Experts™
on
How can I check all checkboxes using the "Select All" checkbox from below please?

                    <ul class="list-group">
                        <li class="list-group-item" style="font-weight: bold;"><input type="checkbox" name="select_all" id="select_all">&nbsp;Select All</li>
                        <%For i = 0 To UBOund(PackMmbrs, 2) - 1%>
                                <li class="list-group-item">
                                    <input type="checkbox" name="select_<%=PackMmbrs(0, i)%>" id="select_<%=PackMmbrs(0, i)%>">
                                    <%=PackMmbrs(3, i)%>, <%=PackMmbrs(2, i)%>(<%=GetTeamName(PackMmbrs(4, i))%>)
                                </li>
                        <%Next%>
                    </ul>

Open in new window


Thank you!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dorababu MSenior Software Engineer
Distinguished Expert 2018
Commented:
Use Jquery try this apply a class to header check box

$(function () {
    $('#selectall').toggle(
        function() {
            $('#list-group-item').prop('checked', true);
        },
        function() {
            $('#list-group-item').prop('checked', false);
        }
    );
});

Open in new window


Or you can try from the link

http://www.jqueryfaqs.com/Articles/Multiple-Select-MultiSelect-DropDownList-with-CheckBoxes-using-jQuery.aspx
Developer & EE Moderator
Fellow 2018
Most Valuable Expert 2013
Commented:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Check box</title>
  <script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script>
$(function(){
  $('#selectAll').on('click',function(){
    if($(this).prop('checked')){ // IF TRUE
            // CHECK THE BOXES
      $('.abc').prop('checked',true);
    }else{
          // UNCHECK THE BOXES
      $('.abc').prop('checked',false);
    }
     
  });
});  
</script>
</head>
<body>
<input type="checkbox" id="selectAll">select all  
  <hr>
<input type="checkbox" class="abc" name="select_1">1
<input type="checkbox" class="abc" name="select_2">2
<input type="checkbox" class="abc" name="select_3"> 3 
</body>
</html>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial