手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery Checkbox 全选 反选的简单实例
jQuery Checkbox 全选 反选的简单实例
摘要:1.全选、反选$(function(){$("#selall").on("click",function(){$("#plalst:chec...

1.全选、反选

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="http://xiazai.jb51.net/201611/yuanma/jquery(jb51.net).rar"></script> <script type="text/javascript"> $(function () { $("#selall").on("click", function () { $("#plalst :checkbox").prop("checked", true); }); $("#selnone").on("click", function () { $("#plalst :checkbox").prop("checked", false); }); $("#resver").on("click", function () { $("#plalst :checkbox").prop("checked", function (i, val) { return !val; }); }); $("#chkAll").on("click", function () { $("#plalst :checkbox").prop("checked", $("#chkAll").prop("checked")) }); }); </script> </head> <body> <div id="plalst"> <input type="checkbox" />一队 <input type="checkbox" />二队 <input type="checkbox" />三队 <input type="checkbox" />四队 <input type="checkbox" />五队 <input type="checkbox" />六队 </div> <br /><br /><br /> <input type="button" id="selall" value="全选" /> <input type="button" id="selnone" value="全不选" /> <input type="button" id="resver" value="反选" /> <input type="checkbox" id="chkAll" /><label for="chkAll" >选择</label> </body> </html>

以上就是本文的全部内容,希望对大家有所帮助,同时也希望多多支持查字典教程网!

【jQuery Checkbox 全选 反选的简单实例】相关文章:

jquery实现弹出层效果实例

判断Checkbox和Radio的一种方法

JQuery自动触发事件的方法

jQuery fancybox在ie浏览器下无法显示关闭按钮的解决办法

Javascript 字符串模板的简单实现

jQuery实现转动随机数抽奖效果的方法

jQuery聚合函数实例

JQuery分屏指示器图片轮换效果实例

jQuery页面的滚动位置scrollTop、scrollLeft

jquery合并表格中相同文本的相邻单元格

精品推荐
分类导航