`

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="取消全选" />
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics