标签:style blog color for cti io
html代码如下:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>全选</title> </head> <body> <ul> <li><input id="all" type="checkbox" autocomplete="off"></li> <li><input type="checkbox" name="groupId" value="2"></li> <li><input type="checkbox" name="groupId" value="2"></li> <li><input type="checkbox" name="groupId" value="2"></li> </ul> </body> </html>
js代码如下:
$("#all").click(function(event) { if(this.checked) { $(‘input[name=groupId]‘).each(function() { this.checked = true; }); }else{ $(‘input[name=groupId]‘).each(function() { this.checked = false; }); } });
标签:style blog color for cti io
原文地址:http://www.cnblogs.com/smilepiu/p/3837692.html