Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to implement "Select All" in Jquery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 129
    Comment on it

    If you would like to implement Select All/UnSelect check-boxes with jquery please follow the below code::

    <table class="demo-table">
    <tr><td><input type="checkbox" name="selectall" id="selectall">Select All</td></tr>
    <tr><td><input type="checkbox" name="select[]" class="ab" value="1"></td></tr>
    <tr><td><input type="checkbox" name="select[]" class="ab" value="2"></td></tr>
    <tr><td><input type="checkbox" name="select[]" class="ab" value="3"></td></tr>
    </table>
    <script>
    $(document).ready(function () {
            $("#selectall").change(function () {            
               if(this.checked){
                    $('.ab').each(function(){
                        this.checked = true;
                    })
                }else{
                    $('.ab').each(function(){
                        this.checked = false;
                    })
                }
            });
    
        });
    </script>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: