title: "Check All" function when using Ryan Fait's "Custom Form Elements"
body: <p>I've made a simple form using Ryan Fait's Custom Form Elements. Now I am trying to implement a "Check All"/"Uncheck All" function. </p>
  
  <p>What I have mostly works, except that the user has to click the buttons twice to get the desired result. I have a feeling that I need to call this function from inside the Custom Form Elements script, but I don't know how. </p>
  
  <p>I'm using JQuery, Custom Form Elements (http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/custom-form-elements.js), and this: </p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
  function cboxToggle(group, action) {
  for( var i=0, len = group.length; i &lt; len; i++) {
  group[i].checked = action;
  }
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>My HTML: </p>
  
  <pre><code>&lt;form name="myname" action="checkboxes.asp" method="post"&gt;
  &lt;input type = "button" value = " CHECK ALL" onclick = "cboxToggle(check_list, !this.checked)"&gt;&lt;br&gt;
  &lt;input type = "button" value = " UNCHECK ALL" onclick = "cboxToggle(check_list, this.checked)"&gt;&lt;br&gt;
  
  &lt;p&gt;&lt;input type="checkbox" name="check_list" value="1" class="styled" /&gt;Option 1 &lt;/p&gt; 
  &lt;p&gt;&lt;input type="checkbox" name="check_list" value="2" class="styled" /&gt;Option 2 &lt;/p&gt;
  &lt;p&gt;&lt;input type="checkbox" name="check_list" value="3" class="styled" /&gt;Option 3 &lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Any help would be appreciated -- thanks!</p>