Skip to content

Instantly share code, notes, and snippets.

@cdeckert
Created July 31, 2012 14:22
Show Gist options
  • Save cdeckert/3217359 to your computer and use it in GitHub Desktop.
Save cdeckert/3217359 to your computer and use it in GitHub Desktop.
jQuery Example - Virgina
<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
var controlCheckboxes = function()
{
if(jQuery(this).is(':checked'))
{
jQuery("div").children().removeAttr("disabled");
}
else
{
jQuery("div").children().attr("disabled", "disabled");
}
}
var controlFirstCheckbox = function()
{
if($("select").val() == 'true')
{
$(".control").show();
}
else
{
$(".control").hide();
}
}
jQuery(document).ready(function() {
controlCheckboxes();
jQuery(".control").on("change", controlCheckboxes);
controlFirstCheckbox();
jQuery("select").on("change", controlFirstCheckbox);
});
</script>
</head>
<body>
<select>
<option value="false">no</option>
<option value="true">yes</option>
</select>
<input type="Checkbox" class="control"/>
<div>
<input type="Checkbox" />
<input type="Checkbox" />
<input type="Checkbox" />
<input type="Checkbox" />
<input type="Checkbox" />
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment