Created
July 31, 2012 14:22
-
-
Save cdeckert/3217359 to your computer and use it in GitHub Desktop.
jQuery Example - Virgina
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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