title: Get id of a checkbox? - jQuery
body: <p>Hey, I am wondering how to get the id of a checkbox when it is checked.</p>
  
  <p>This is what my HTML would probably look like at first:</p>
  
  <pre><code>&lt;div class="check_filter"&gt;
  
      &lt;div id="filter"&gt;
          &lt;input type="checkbox" id="check1" /&gt;&lt;label for="check1"&gt;Marketing&lt;/label&gt;
          &lt;input type="checkbox" id="check2" /&gt;&lt;label for="check2"&gt;Automotive&lt;/label&gt;
          &lt;input type="checkbox" id="check3" /&gt;&lt;label for="check3"&gt;Sports&lt;/label&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;&lt;!-- End check_filter --&gt;
  </code></pre>
  
  <p>I'm assuming the jQuery would look something like this:</p>
  
  <pre><code>$(document).ready(function() {    
      $(":checkbox").click(function(){
          var id = $(this).attr('id');
  
          $.post("index.php", { id: id });
         //return false to ensure the page doesn't refresh
         return false;
      });    
  });
  </code></pre>
  
  <p>I'm trying to get the checked item id and then post that id in a mysql query to grab the results of the id from the database.</p>
  
  <p>Thanks for any help on this.</p>