title: checkbox check/uncheck using d3
body: <p>I am having difficulty checking and unchecking checkboxes using d3 selection. The following code doesn't seem to work. I want all check boxes to be checked when 'check' is pressed, and all checkboxes unchecked when 'uncheck' is pressed.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;body&gt;
  &lt;input type="checkbox"&gt;
  &lt;input type="checkbox"&gt;
  &lt;input type="checkbox"&gt;
  &lt;button type='button' onclick='checkAll()'&gt;Check&lt;/button&gt;
  &lt;button type='button' onclick='uncheckAll()'&gt;Uncheck&lt;/button&gt;
  
  &lt;script src="http://d3js.org/d3.v2.min.js?2.10.0"&gt;&lt;/script&gt;
  
  &lt;script&gt;
  function checkAll(){
      d3.selectAll('input').attr('checked','true');
  }
  function uncheckAll(){
      d3.selectAll('input').attr('checked','false');
  }
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>