title: Select all checkboxes with jQuery not working
body: <p>I have this issue and can't figure out why my code isn't working.</p>
  
  <p>I want to select all checkboxes when clicking on "Todas".</p>
  
  <p>I made a <a href="http://jsfiddle.net/jimena/y3N2J/" rel="nofollow noreferrer">fiddle</a> with the code and it works there, but when running on my project it doesn't, even though no errors are displayed while inspecting.</p>
  
  <p>The jQuery function is from another <a href="https://stackoverflow.com/questions/2228382/select-all-checkboxes-with-jquery">post</a> :</p>
  
  <pre><code>$('#allstates').click(function() {
      var c = this.checked;
      $(':checkbox').prop('checked',c);
  });
  </code></pre>
  
  <p>and html code snippet is:</p>
  
  <pre><code>&lt;div class="hide" id="states"&gt;
    &lt;div class="control-group"&gt;                           
      &lt;label class="control-label"&gt;Seleccione&lt;/label&gt;
        &lt;div class="controls"&gt;
          &lt;label class="checkbox span4"&gt;
            &lt;input type="checkbox" class="all" value="all" id="allstates" name="all"/&gt;Todas
          &lt;/label&gt;
          &lt;label class="checkbox span4"&gt;
            &lt;input type="checkbox" value="Caba" id="" name="st[]"/&gt;Ciudad Autónoma de Buenos Aires
          &lt;/label&gt;
          &lt;label class="checkbox span4"&gt;
            &lt;input type="checkbox" value="Buenos Aires" id="" name="st[]"/&gt; Buenos Aires
          &lt;/label&gt;
          &lt;label class="checkbox span4"&gt;
            &lt;input type="checkbox" value="Catamarca" id="" name="st[]"/&gt; Catamarca
          &lt;/label&gt;
          &lt;label class="checkbox span4"&gt;
            &lt;input type="checkbox" value="Chaco" id="" name="st[]"/&gt; Chaco
          &lt;/label&gt;
         &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Am I missing something? </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Found out by inspecting that the template I use adds these lines to the checkboxes and that is why this doesn't work on my code, but it does on fiddle.</p>
  
  <p>Here is a snippet:</p>
  
  <pre><code>&lt;label class="checkbox span4"&gt;
      &lt;div class="checker"&gt;
       &lt;span&gt;&lt;input type="checkbox" value="Buenos Aires" id="" name="st[]"&gt;
       &lt;/span&gt;
      &lt;/div&gt; Buenos Aires
  &lt;/label&gt;
  </code></pre>
  
  <p>So now I'm still struggling to check and uncheck the elements...</p>