selectAll—part II
来源:互联网 发布:在淘宝买甩棍违法吗 编辑:程序博客网 时间:2024/06/07 00:37
之前写过一个全选的,以下是从
http://blog.csdn.net/fcc0429/article/details/74931807
摘抄的布局;
<div id="formdiv"> <input type="checkbox" name="checkoption">篮球<p> <input type="checkbox" name="checkoption">足球 <p> <input type="checkbox" name="checkoption">网球 <p> <input type="checkbox" name="checkoption">台球 <p> <input type="checkbox" id="selectAll"> <label for="selectAll">全选</label></div>
这次使用jquery来写
$( $inputItem = $("input[name='checkoption']"), $selectAll = $("#selectAll"), $selectAll.click(function () { $inputItem.each(function () { $(this).prop("checked", $selectAll.prop("checked")) }) }), $("#formdiv").delegate($inputItem, "click", function () { $inputItem.each(function () { $inputChecked=$("input[name='checkoption']:checked").length; if($inputChecked===$inputItem.length){ $selectAll.prop("checked", true) } else { $selectAll.prop("checked", false) } }) }) )
这里用input.cheked.length用的很好;
就是在想,以上代码是否有什么性能上的问题?
阅读全文
0 0
- selectAll—part II
- %SelectAll
- Part II
- zbox的测试例——selectAll+selectInverse
- Part II RCP 举例
- dotNet Threading, Part II
- PART II SYSTEMS PROGRAMMING
- Thinking in C++, Part II
- Best Classical Novels Part II
- 4. OpCode:Prefixes - Part II
- Playing with ptrace, Part II
- Eiffel 引介 Part I,II
- Playing with ptrace, Part II
- CUDA Programming Basics Part II
- LESSON 6 MALWARE part II
- LINQ To XML-Part II
- Notes Part II: Numeral Systems
- Playing with ptrace, Part II
- LARAVEL配置文件丢失的错误'Class log does not exist'
- win10 64位+git (v2.13.1) 同一台电脑向两个github账号提交
- ubuntu Windows
- opencv图片旋转后图片无法填满窗口有黑边解决方法
- JavaScript面向对象
- selectAll—part II
- oracle查看允许的最大连接数和当前连接数等信息
- java基础——collections.sort()排序方法使用方法
- Java Log4j使用总结和实践
- eclipse 创建maven web工程项目
- 文章标题
- EventBus 3.0 从入门到精通——使用详解(一)
- iOS 获取手机外网IP地址的成功与失败
- 用Maven插件生成Mybatis代码