手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery实现复选框成对选择及对应取消的方法
jQuery实现复选框成对选择及对应取消的方法
摘要:本文实例讲述了jQuery实现复选框成对选择及对应取消的方法。分享给大家供大家参考。具体实现方法如下:复制代码代码如下:jQuery实现复选...

本文实例讲述了jQuery实现复选框成对选择及对应取消的方法。分享给大家供大家参考。具体实现方法如下:

复制代码 代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>jQuery实现复选框成对选择,对应取消功能</title>

<script type="text/javascript" src="http://www.jb51.netjs/jquery-1.6.2.min.js"></script>

<script>

$(function(){

var classA = $(".classA");

classA.change(function(){

classA.attr("checked",Boolean($(this).attr("checked")));

})

var classB = $(".classB");

classB.change(function(){

classB.attr("checked",Boolean($(this).attr("checked")));

})

})

</script>

</head>

<body>

<p>A组</p>

<input type="checkbox">

<input type="checkbox">

<p>B组</p>

<input type="checkbox">

<input type="checkbox">

</body>

</html>

希望本文所述对大家的jQuery程序设计有所帮助。

【jQuery实现复选框成对选择及对应取消的方法】相关文章:

jQuery仿gmail实现fixed布局的方法

JQuery中上下文选择器实现方法

jQuery计算文本框字数及限制文本框字数的方法

JQuery自动触发事件的方法

jQuery实现给页面换肤的方法

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

javascript实现十秒钟后注册按钮可点击的方法

Javascript实现div层渐隐效果的方法

jQuery实现html表格动态添加新行的方法

jQuery实现延迟跳转的方法

精品推荐
分类导航