Add the following to your script:

     if ( $(this).is(':checked') ) {
       $('#CheckAll').html('Uncheck All');
    } else {
       $('#CheckAll').html('Check All');
    }
 MaurĂ­cio

  -----Mensagem Original----- 
  De: evanbu...@gmail.com 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 25 de junho de 2009 13:12
  Assunto: [jQuery] Toggle Text



  Hi

  I'm using this to check/uncheck a group of checkboxes which works
  fine.  However, when all of checkboxes are checked, I would like the
  span id="CheckAll" to read "Uncheck All" and to toggle back to "Check
  All" when all of the boxes are unchecked.

  <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
      <script type="text/javascript">
      $(document).ready(function() {
              $('#chkAll').click(
               function() {
                  $("INPUT[type='checkbox']").attr('checked', $
  ('#chkAll').is(':checked'));
              });
           });
  </script>

  <tr>
  <td><input name="chkAll" id="chkAll" type="checkbox" Checked /></td>
  <td class="style2"><em><strong><span id="CheckAll">Check All</span></
  strong></em></td>
  </tr>

  Thanks

Reply via email to