-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
41 lines (40 loc) · 1.14 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Expand Menu</title>
</head>
<body>
<!-- expand-menu works like a container -->
<div class="expand-menu">
<!-- expand-condition is the condition to perform a action -->
<div class="expand-condition">
<fieldset>
<input type="radio" name="options" value="yes" />
<input type="radio" name="options" value="no" />
</fieldset>
</div>
<!-- expand-this to show content when condition is true -->
<div class="expand-this">
<label for="where">From where you hear about us ?</label>
<input type="text" name="where" />
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$('.expand-menu input:radio').click(function(){
var $value = $(this).val();
// select content to show
var $expandThis = $(this).parents('.expand-condition').siblings('.expand-this');
// condition 1
if($value === 'yes'){
$expandThis.slideDown(200);
}
// condition 2
if( $value === 'no'){
$expandThis.slideUp(200);
}
})
</script>
</body>
</html>