title: How to get selected checkbox value out of multiple checkboxes in a group (can select atmost one)
body: <p>I have 3 checkboxes and need user to select atmost one at a time, so have a code where everytime user selects one of my checkboxes. I deselect all other and check the selected one using:</p>
  
  <pre><code>$('input.myclass').click(function () {
      $('input.myclass:checked').not(this).removeAttr('checked');
  });
  </code></pre>
  
  <p>Just below this code, I also get value of checked checkbox and display it somewhere on page (for simplicity sake, let it be alert). For that I am using:</p>
  
  <pre><code>var sFilter = "";
  $('input.myclass[type=checkbox]').each(function () {
      sFilter = sFilter + (this.checked ? $(this).val() : "");
  });
  </code></pre>
  
  <p>Now, what happening is <code>sFilter</code> always has recently selected checkbox and last selected checbox. like: If I have checkbox 1,2,3. Initially when I select checkbox 2, I get 2 in my alert, but when I choose 3 , I get 2,3. I presume whats happening here is at a point where code goes through all the checkbox with particular class, it stills thinks that I have checkbox 2 <code>checked</code> considering I have just cleared/unchecked using <code>click</code> function.</p>
  
  <p>Does anyone has suggestion on how i can get around this problem?</p>
  
  <p>Thanks</p>
  
  <p><strong>NB:</strong> Cant use radio-buttons due to UI.</p>