首页 > Web开发 > 详细

jquery全选反选

时间:2015-10-08 13:00:29      阅读:253      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html>
  <head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv="Content-Type" content="text/html; charset=gbk" />
  <title>test</title>
  </head>
  <script type="text/javascript" src="jquery.js?2015"></script> <!--不能用<script src="jquery.js"/>,必须<script></script> -->
  <script type="text/javascript" language="javascript">
     $(document).ready(function(){
     
     $("#selectAllorNone").click(function(){
         //alert(‘run‘);
        
        $("#checkList :checkbox").each(function(){
          //alert(‘run‘);
          $(this).attr("checked",!$(this).attr("checked"));

        });
        
         
     });
     });
  </script>
 <body>
   <div id="checkList">
      <input type="checkbox">心</input>
      <input type="checkbox">想</input>
      <input type="checkbox">事</input>
      <input type="checkbox">成</input>
   </div>
   <input type="button" value="全选/全不选" id="selectAllorNone">
  <input>
 </body>
</html>

 

jquery全选反选

原文:http://www.cnblogs.com/kuiyeit/p/4860573.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!