simple jQuery (check and uncheck)

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<style type="text/css">
.class-red{
border: red solid 1px;

}
</style>
<script type="text/javascript">
$(document).ready(function(){
$("input:button").bind("click",click);
});

function click() {
  $(".checkbox-group input").each(function(){
if($(this).attr("checked")=="checked"){
  $(this).attr("checked","");
$(this).removeClass("class-red");
} else {
$(this).attr("checked","checked");
$(this).addClass("class-red");
}
  });
}
</script>
</head>

<body>
<div class="checkbox-group">
<input type="checkbox" checked="checked"/>
<input type="checkbox" checked="checked"/>
<input type="checkbox" checked="checked"/>
<input type="checkbox" checked="checked"/>
<input type="checkbox" checked="checked"/>
<input type="text"/>
</div>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<input type="button" value="click here!"/>
</body>

</html>

原文地址:https://www.cnblogs.com/sharepointhome/p/2087512.html