title: Check all check boxes and check specific check box in an array
body: <p>I am using this <strong>javascript</strong> function for checking all check box...it's working fine but if I want to check a specific check box 1 or 2 or more then I get an array of all but I didn't get specific check box value please tell me if any function in javascript or jQuery exists to do this. </p>
  
  <pre><code>var checkflag = "false";
  
  function check(field) {
    if (checkflag == "false") {
        for (i = 0; i &lt; field.length; i++) {
            field[i].checked = true;
        }
        checkflag = "true";
        return "Uncheck All";
    } else {
        for (i = 0; i &lt; field.length; i++) {
            field[i].checked = false;
        }
        checkflag = "false";
        return "Check All";
    }
  }
  </code></pre>