jQuery checkbox 全选/反选

引用通告(0) 评论(0)

项目开发时要用到全选/反选,于是随手写了一个插件,适用于jQuery1.2.2之后的版本

使用方法:
js里面加入


  $(document).ready(function(){
   var chk_options = {
    invert:'#invert',    //反选框id,可以使用jQuery支持的格式
    all:'#checkAll',    //全选框id,可以使用jQuery支持的格式
    item:'.checkitem'    //被操作的CheckBox,可以使用jQuery支持的格式
   };
   $(this).chk_init(chk_options);
  });

在html页面中相应的位置加上上面的属性即可,如下:

        <div>
        <input type="checkbox" class="checkitem"/>A<br />
        <input type="checkbox" class="checkitem"/>B<br />
        <input type="checkbox" class="checkitem"/>C<br />
        <input type="checkbox" class="checkitem"/>D<br />
        <input type="checkbox" class="checkitem"/>E<br />
        <input type="checkbox" class="checkitem"/>F<br />
        <input type="checkbox" class="checkitem"/>G<br />
        </div>
        <div id="div2">
        <input type="checkbox" id="checkAll"/>CheckAll
        &nbsp;&nbsp
        <input type="checkbox" id="invert"/>Invert
        </div>

下载地址:
http://jqueryplugin.googlecode.com/files/CheckBox.zip

引用通告(0)

被引用的日记: jQuery checkbox 全选/反选

TrackBack URL for this entry: http://www.thinkjam.org/loveblog/tjtb.cgi/1177
如果您想引用这篇日记到您的Blog,
请复制上面的链接,放置到您发表文章时的相应界面中。

发表评论

最新发布

jQuery FlyTo效果
从一个地方飞到另一个地方把jQuery的…
jQuery checkbox 全选/反选
项目开发时要用到全选/反选,于是随手写了…
SproutCore
SproutCore被形容为"开源,跨平…