<!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>
<title>Untitled Page</title>
<script src="../s/jquery-1.2.6.pack.js" type="text/javascript"></script>
</head>
<body>
<p>
check all/none example.
</p>
<p id="test">
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<input type="checkbox" /><br />
<br />
<input type="button" value="Check All" onclick="CA(1);" />
<input type="button" value="Check None" onclick="CA(0);" />
</p>
</body>
<script language="javascript" type="text/javascript">
function CA(w){
$("#test").find("input[@type$='checkbox']").each(function() {
this.checked = (w == 0) ? false : true;
});
}
</script>
</html>
A Southwestern adventurer striking out into the badlands of the Midwest for fun, profit, and for a wife who wouldn't move back to the Southwest :)
Monday, July 14, 2008
Jquery Check All
Another tutorial example, others have posted more elegant solutions, but here is my example.
Labels:
Javascript,
Jquery,
Web Development
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment