Need some help working with checkboxes..

Need some help working with checkboxes..

Looking how to put some sort of check so that if two checkboxes within the same ul are checked, at least once anywhere on the page, button "Two" does not get enabled.. I probably need to have some sort of loop checking each ul maybe?? I have cut the code down to a bare minimum, but there are many ul being created on the page dynamically.. Not just two like in this example.. Here is sample script..

  1. <script src="http://code.jquery.com/jquery-latest.js"></script>
  2. <script>
  3. $('input.choice').live('click', function(){
  4.     if ($('input.choice:checkbox:checked').length > 0) {
  5.         $('#one').attr('disabled', '');
  6.         if ($('input.choice:checkbox:checked').length > 1) {
  7.             // if two checkboxes are checked in the same ul,
  8.             // disable button "Two", else enable button "Two"
  9.             $('#two').attr('disabled', '');
  10.         } else {
  11.             $('#two').attr('disabled', 'disabled');
  12.         }
  13.     } else {
  14.         $('#one').attr('disabled', 'disabled');
  15.         $('#two').attr('disabled', 'disabled');
  16.     }
  17. });
  18. </script>
  19. List One
  20. <ul>
  21.     <li class="one"><input type="checkbox" class="choice" /></li>
  22.     <li class="one"><input type="checkbox" class="choice" /></li>
  23. </ul>
  24. List Two
  25. <ul>
  26.     <li class="one"><input type="checkbox" class="choice" /></li>
  27.     <li class="one"><input type="checkbox" class="choice" /></li>
  28. </ul>
  29. <input type="submit" value="One" id="one" disabled="disabled" />
  30. <input type="submit" value="Two" id="two" disabled="disabled" />