title: Get the ID by Class name JQuery
body: <p>Hi this is a <code>jquery</code> question:</p>
  
  <p>supposed i have this:</p>
  
  <pre><code>&lt;input type="checkbox" class="select" id ="select-1"&gt;
  
  &lt;input type="checkbox" class="select" id ="select-2"&gt;
  </code></pre>
  
  <p>and i want to <strong>get the id, of the checkbox</strong> that has been selected when i click a submit button (note: you can only select 1)
  and i have this button click event here:</p>
  
  <pre><code>$("#submit").click(function(){
  
            if($(".select").is(':checked')){
  
                alert($(".select").attr('id'));
            }
  });
  </code></pre>
  
  <p>It <strong>always alerts "select-1"</strong> even if i select the checkbox with the "select-2" id.. I'm guessing since they're both in the same class the first one with the ".select" class to be found is displayed in the alert.. how do i get the specific id that is checked by using their class names? Thank You! </p>