Skip to content

Instantly share code, notes, and snippets.

@zmpeg
Created January 27, 2012 21:01
Show Gist options
  • Save zmpeg/1690898 to your computer and use it in GitHub Desktop.
Save zmpeg/1690898 to your computer and use it in GitHub Desktop.
showfor usage
<!DOCTYPE>
<html>
<head>
<title>showfor</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="showfor.jquery.js"></script>
<script type="text/javascript">
$(function() {
$("#b").showfor("#a", { hideChild:true, disableChild:true });
});
</script>
</head>
<body>
<form>
<select id="a" name="a">
<option value="">--Choose A--</option>
<option value="1">A1</option>
<option value="2">A2</option>
<option value="3">A3</option>
</select>
<select id="b" name="b">
<option value="">--Choose A First--</option>
<option value="1" class="show-for-1">B1</option>
<option value="2" class="show-for-1">B2</option>
<option value="3" class="show-for-1">B3</option>
<option value="4" class="show-for-2">B4</option>
<option value="5" class="show-for-2">B5</option>
<option value="6" class="show-for-2">B6</option>
<option value="7" class="show-for-3">B7</option>
<option value="8" class="show-for-3">B8</option>
<option value="9" class="show-for-3">B9</option>
</select>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment