Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get all check boxes values in array under Jquery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 128
    Comment on it

    If you would like to get all selected check boxes value in an array. Please use the below code::

    <table class="demo-table">
    <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>
    <tr><td><input type="button" name="getValue" value="Get Value" onclick="temp();">
    </table>
    <script>
    function temp(){   
       var arr = $('input:checkbox:checked.ab').map(function () {   //ab is the class name of checkbox
          return this.value;
        }).get();
    

    //arr is an array having all the selected checkbox value

    }
    </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: