HTML 使用jQuery选中复选框 简易版
<html>
<head>
? ?<meta charset="utf-8">
? ?<script src="jquery-1.7.2.js"></script>
</head>
<body>
? <br/><br/>
? <button id="one">全部選中/全部取消</button>
<br/><br/><br/>
? ? ? ?<form>
? ? ? ? ? ? ? ? ?<input ? type="checkbox"/>時間
? ? ? ? ? ? ? ??<input ? type="checkbox"/>金錢
? ? ? ? ? ? ? ??<input ? type="checkbox"/>生命
? ? ? ? ? ? ? ??<input ? type="checkbox"/>未來
? ? ? ? ? ? ? ??<input ? type="checkbox"/>現在
? ? ? ? ? ? ? ??<input ? type="checkbox"/>過去
? ? ? </form>
<br/><br/>
</body>
<script>
? ? ?var i=false;
? ? ?$("#one").click(function () {
? ? ? ? ? ?if(i){
? ? ? ? ? ? ? ??$("input:checkbox").attr("checked",false);
? ? ? ? ? ? ? ??i=false;
? ? ? ? ? ?}else{
? ? ? ? ? ? ? ??$("input:checkbox").attr("checked",true);
? ? ? ? ? ? ? ??i=true;
}
});
</script>
</html>
轉載于:https://www.cnblogs.com/SKTT1/p/7607894.html
總結
以上是生活随笔為你收集整理的HTML 使用jQuery选中复选框 简易版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2016 ICPC 北京
- 下一篇: Verilog hdl 宏定义编译报错