Skip to content

Instantly share code, notes, and snippets.

@elleryq
Last active September 18, 2017 13:20
Show Gist options
  • Save elleryq/877441dbe038f3f798f3b5480dfd68d7 to your computer and use it in GitHub Desktop.
Save elleryq/877441dbe038f3f798f3b5480dfd68d7 to your computer and use it in GitHub Desktop.
jQuery 1.2 checkbox demo
<html>
<head>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load jQuery
google.load("jquery", "1.2");
</script>
<script type="text/javascript">
google.setOnLoadCallback(function() {
$("input[name=chk]").change( function() {
$(this).parent().toggleClass( "checked" );
} );
$("input[name=chk1]").change( function() {
$(this).parent().parent().children().toggleClass( "checked" );
} );
} );
</script>
<style type="text/css">
<!--
.checked {
background-color: #EEEEFF;
}
-->
</style>
</head>
<body>
<p><input type="checkbox" name="chk" value="1"/>Test</p>
<table border='1'><tr><td><input type="checkbox" name="chk1" value="1"/>Test</td><td>second column</td></tr></table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment