2008-01-16

jQuery全选

  1. <script type="text/javascript">
  2. $(function() {
  3. $("#selectall").click(function() {
  4. $("input[@name='shareuser[]']").each(function() {
  5. $(this).attr("checked", true);
  6. });
  7. });
  8. $("#deselectall").click(function() {
  9. $("input[@name='shareuser[]']").each(function() {
  10. $(this).attr("checked", false);
  11. });
  12. });
  13. });
  14. </script>
  15. <input type='checkbox' id='in-shareuser-10' name='shareuser[]' value='10' />UserA
  16. <input type='checkbox' id='in-shareuser-11' name='shareuser[]' value='11' />UserB
  17. <input type='checkbox' id='in-shareuser-12' name='shareuser[]' value='12' />UserC
  18. <input type="button" id="selectall" name="selectall" value="全选" />
  19. <input type="button" id="deselectall" name="deselectall" value="取消全选" />
评论
发表评论

提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则

您还没有登录,请登录后发表评论

zfms
搜索本博客
存档
最新评论