title: jQuery: Checking values of checkboxes on page (re)load
body: <p>Greetings,</p>
  
  <p>Being new to jQuery's syntax, I find myself being a bit thrown off when writing up some code.  So while I realize my issue is very likely a logic issue, I'm still have issues finding it because of the syntax that I'm not used to.</p>
  
  <p>I have a series of <code>&lt;li&gt;</code> tags that have an <code>&lt;input type="checkbox"&gt;</code> within each of them.  When the page is refreshed, the checkboxes remain checked, however the <code>&lt;li&gt;</code> needs to keep the class of .grey attached still, but it loses it.  Here is the code I'm trying to use at the moment to fix this issue:</p>
  
  <pre><code>$('#servemod').ready(function() {
      $('#servemod').find('li').each( function() {
      if ($('li').find('input:checkbox').attr('checked')==1) {
          /*alert($(this).find('input:checkbox'));*/
          /*alert($('li').find('input:checkbox').attr('checked'));*/
              $(this).addClass('grey');
  
      }
      });
  });
  </code></pre>
  
  <p>I'm currently using the alert boxes to tell me exactly which part of the DOM the jQuery is currently looking at, and it seems okay. But the problem is that even with the loop, it only seems to test the first <code>&lt;li&gt;</code>'s checked state.  If the first one is checked, the loop goes through and turns ALL <code>&lt;li&gt;</code>'s to blue.  If the first one is not checked, it does nothing.  I'm positive this is something very basic, but I've been at this for hours and I'm just not seeing it.  Any help would be greatly appreciated.</p>
  
  <p>The full code to the html section (with a lot of fluff pulled out)</p>
  
  <pre><code>&lt;div id="servemod"&gt;
     &lt;ul&gt;
        &lt;li&gt;&lt;input type="checkbox"&gt;&lt;p&gt;box 1&lt;/p&gt;
        &lt;li&gt;&lt;input type="checkbox"&gt;&lt;p&gt;box 2&lt;/p&gt;
     &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The css value for grey is just a colour change to blue.</p>