iseriouslyneedhelp Posted August 6, 2011 Share Posted August 6, 2011 I can't figure out why this doesn't work, it checks but doesn't uncheck: Javascript: $( function() { $( '.checkAll' ).live( 'change', function() { $( '.checkall' ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' ); $( this ).next().text( $( this ).is( ':checked' ) ? 'Uncheck All' : 'Check All' ); }); $( '.checkall' ).live( 'change', function() { $( '.checkall' ).length == $( '.checkall:checked' ).length ? $( '.checkAll' ).attr( 'checked', 'checked' ).next().text( 'Uncheck All' ) : $( '.checkAll' ).attr( 'checked', '' ).next().text( 'Check All' ); }); }); HTML: <tbody> <tr> <td width=""><input type="checkbox" name="checkall" class="checkall" value="<?php echo $row['ID']; ?>"></td> <td width=""><a href="/backend/contacts/editcontact.php?ID=<?php echo $row['ID']; ?>"><strong><?php echo $row['firstname']; ?> <?php echo $row['lastname']; ?></strong></a></td> <td width=""><?php echo $row['phonecell']; ?> </td> <td width=""><a href="<?php echo $row['email']; ?>"><?php echo $row['email']; ?></a> </td> <td width=""><?php echo $row['contactstatus']; ?> </td> <td width=""><?php echo $row['contacttype']; ?> </td> <td width=""><?php echo $row['type']; ?> </td> <td><? echo date("F d, Y", strtotime($row['reminder'])); ?></td> <td><a href="/backend/contact/notes.php?ID=<?php echo $row['tasknotes']; ?>">Notes</a></td> <td><a href="/backend/call-center/callcenter.php?ID=<?php echo $row['ID']; ?>">Call</a></td> <td><a href="mailto:<?php echo $row['email']; ?>">Email</a></td> <td><a href="/backend/contacts/deletesuccess.php?ID=<?php echo $row['ID']; ?>">Delete</a></td> </tr> </tbody> Quote Link to comment https://forums.phpfreaks.com/topic/244001-check-uncheck-box/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.